#discord-bots

1 messages ยท Page 1060 of 1

jagged adder
#

yeah sounds about right

#

no, only temp atm i think

cloud dawn
#

Well ```py
[
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]

jagged adder
#

though maybe permanently later im not sure

oblique laurel
#

Is the data user specific? Like would one player have a dif value than another?

potent spear
jagged adder
#

at the moment the program can be restarted, resetting all values

cloud dawn
jagged adder
#

ideally later on i would have it save the info between "sessions" but i have no clue how to do so

oblique laurel
cloud dawn
oblique laurel
vale wing
#

!e

class Item:
    def __init__(self, name, is_active):
        self.name = name
        self.is_active = is_active

    def __str__(self):
        return f"<Item name=\"{self.name}\">"

items = [Item("e", True), Item("sus", False), Item("fungus", True)]
filtered_items = map(str, filter(lambda x: x.is_active, items))
print(", ".join(filtered_items))```
unkempt canyonBOT
#

@vale wing :white_check_mark: Your eval job has completed with return code 0.

<Item name="e">, <Item name="fungus">
jagged adder
#

so far, ive got an inventory class which is simply a list of the different "items" all default set to false.

flint isle
#

how do i add typehints or descriptions for the argument in a slash command?

cloud dawn
jagged adder
#

as players interact with items during play, it will set the items they interact with to true

#

and i want a way to print only the trues from that class list

#

if im doing somethin wrong there feel free to correct me

vale wing
jagged adder
#

im sure there is tons of ways to optimize my code; lack of knowledge means its a mix of shiz atm

vale wing
#

Tho class is better

cloud dawn
unkempt canyonBOT
#

@discord.app_commands.describe(**parameters)```
Describes the given parameters by their name using the key of the keyword argument
as the name.

Example...
jagged adder
vale wing
#

I don't understand the second sentence

#

!d filter

unkempt canyonBOT
#

filter(function, iterable)```
Construct an iterator from those elements of *iterable* for which *function* returns true. *iterable* may be either a sequence, a container which supports iteration, or an iterator. If *function* is `None`, the identity function is assumed, that is, all elements of *iterable* that are false are removed.

Note that `filter(function, iterable)` is equivalent to the generator expression `(item for item in iterable if function(item))` if function is not `None` and `(item for item in iterable if item)` if function is `None`.

See [`itertools.filterfalse()`](https://docs.python.org/3/library/itertools.html#itertools.filterfalse "itertools.filterfalse") for the complementary function that returns elements of *iterable* for which *function* returns false.
vale wing
#

Cool function trust ๐Ÿ˜‰

cloud dawn
#

Be glad Exenifix typed it, i would've add scary typehints as well

jagged adder
#

lol

slate swan
#

how sad

loud junco
vale wing
#

It's probably better to use list comprehension instead of map+filter cause we will only do one full iteration instead of 2

hazy oxide
#

anyone know how to get a member without pinging them (nextcord)? (?infouser iamamember/iam instead of ?infouser @iamamember)

gaunt ice
#

ashley

slate swan
gaunt ice
#

which db do u prefer for sql

hazy oxide
#

didn't realize i pinged them

slate swan
gaunt ice
#

ohh

#

alr my exams get over tmrw so

slate swan
#

congrats

#

did well?

gaunt ice
#

yup

#

i hope ๐Ÿ‘€

slate swan
slate swan
hazy oxide
slate swan
#

huh

#

thas not even a thing

cloud dawn
#

Well for bot you can revoke the AllowedMentions resulting in highlighting without ping.

vale wing
#

Comprehension is 2e-6 seconds faster confirmed

#

For big lists may be faster

stone beacon
#

It will be

vale wing
#

Now map+filter is faster

jagged adder
#

what does list comprehension actually mean

vale wing
#

So yeah use builtins that are written on c

placid skiff
wet crystal
#

How do you have a @bot.command() only be callable in a certain channel?

vale wing
#

Use a check for it

wet crystal
vale wing
#

I don't remember correctly but I think it is this

@commands.check(lambda ctx: ctx.channel.id == 123456789012345678)```
#

!d discord.ext.commands.check

unkempt canyonBOT
#

@discord.ext.commands.check(predicate)```
A decorator that adds a check to the [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or its
subclasses. These checks could be accessed via [`Command.checks`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command.checks "discord.ext.commands.Command.checks").

These checks should be predicates that take in a single parameter taking
a [`Context`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context"). If the check returns a `False`-like value then
during invocation a [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure") exception is raised and sent to
the [`on_command_error()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") event...
slate swan
placid skiff
#

i mean, without a classic loop

vale wing
#

next()

flint isle
#
WhiskeyBot [Beta] BOT
 โ€” Today at 9:13 AM
This command is outdated, please try again in a few minutes
Only you can see this โ€ข Dismiss message

OOF

placid skiff
#

like for _ in list: #do_something

vale wing
#

iter()

slate swan
vale wing
#

Wait a few minutes as it says

slate swan
#

reloading fixes it for me though

stray carbon
#

interaction_check goes under button class or view class?

vale wing
#

Or you want no loops at all

cloud dawn
halcyon onyx
#

hello

#

does any one know how i can handle this error: TypeError: Main.on_message() missing 1 required positional argument: 'message'

vale wing
#

!e py nice_list = [0, 1, 2] it = iter(nice_list) print(next(it)) print(next(it)) print(next(it))

unkempt canyonBOT
#

@vale wing :white_check_mark: Your eval job has completed with return code 0.

001 | 0
002 | 1
003 | 2
vale wing
#

There you go no loops ๐Ÿ˜ฉ

flint isle
#

how can i respond to the slash. it keeps saying the application did not respond.

vale wing
slate swan
vale wing
#

Wrong ping

halcyon onyx
#

@client.event
async def on_message(self,message):
channel = str(message.channel)
if channel == '??':
if message.content == f"{self.sign}start":
client.loop.create_task(self.my_background_task())
if message.content == f"{self.sign}stop":
start = False

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

vale wing
#

Is this a cog

slate swan
halcyon onyx
#

no

vale wing
#

Then why self

halcyon onyx
#

not cog

#

im using class rn

vale wing
#

Do you instantiate your class

#

99% sure you don't

halcyon onyx
#

this?

vale wing
#

Wth

#

Use cogs

slate swan
#

they are subclassing Bot

vale wing
#

This is the weirdest thing I've seen in like 3 months

#

Client var + bot subclass

flint isle
#

hmm... how do i remove all of a โœ… reaction?

halcyon onyx
#

im crying blood trying to fix it

vale wing
#

The what

slate swan
#

wait what

vale wing
unkempt canyonBOT
#

class discord.Message```
Represents a message from Discord...
flint isle
#

!disnake message

vale wing
#

Same for disnake

robust fulcrum
#

That's on views not buttons

vale wing
vale wing
flint isle
#

its clear_reaction for a specific one and clear_reactions for all of them

paper sluice
robust fulcrum
vale wing
robust fulcrum
vale wing
#

The discord.ui.button decorators

#

Are for adding buttons with callback

flint isle
#

hmm... how do i add options to a button like :checkmark:, :furheart:, or both

flint isle
vale wing
#

You can also make a more complicated class for convenience

#

Like I did

flint isle
vale wing
paper sluice
vale wing
#

See docs are easy

#

For python libs

#

For java libs most of them are as aids as java itself ๐Ÿ’€

cloud dawn
vale wing
#

Me too

slate swan
#

im gonna start learning rust๐Ÿ˜ณ

cloud dawn
#

I needed to convert a json response to an object, I've never been more scarred.

cloud dawn
vale wing
#

Was trying to make doc to pdf converter and spent like a day trying to find a normal lib (I haven't found one yet)

slate swan
vale wing
#

Most of them have last commit in 2016 and depend on old artifacts

placid skiff
#

Bruh searching a java lib is like searching someone who know machine language

placid skiff
#

you will have to do it by your own Phx_PepoLaugh

flint isle
#

how can i add options to a var in a slash command?

vale wing
#

API working in java is cool (sarcasm)

cloud dawn
# placid skiff you will have to do it by your own <:Phx_PepoLaugh:734215885195182150>
package com.example.myapplication;

import java.util.List;

class Coords {
    double lon;
    double lat;
}

class Weather {
    int id;
    String main;
    String description;
    String icon;
}

class Main {
    double temp;
    double feels_like;
    double temp_min;
    double temp_max;
    int pressure;
    int humidity;
}

class Wind {
    double speed;
    int deg;
    double gust;
}

class Clouds {
    int all;
}

class Sys {
    int type;
    int id;
    String country;
    int sunrise;
    int sunset;
}

public class WeatherData {
    String base;
    int visibility;
    int dt;
    int timezone;
    int id;
    String name;
    int cod;

    Coords coord;
    List<Weather> weather;
    Main main;
    Wind wind;
    Clouds clouds;
    Sys sys;
}
``` this is what i needed to make in the end.
placid skiff
#

Lol

vale wing
#

This is how you get json response in java ๐Ÿ˜€ ๐Ÿ‘

unkempt canyonBOT
#

app/src/main/java/com/exenifix/weatherapp/WeatherService.java lines 92 to 101

input = connection.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8));
StringBuilder sb = new StringBuilder();

int cp;
while ((cp = reader.read()) != -1) {
    sb.append((char) cp);
}
input.close();
return new JSONObject(sb.toString());```
cloud dawn
vale wing
#

Some libs provide easier requests management but imho everything just starts to look even more flooded

cloud dawn
#

I used Volley

#

Still figuring out what the best libs are and syntax etc.

#

Took me a solid 20 min also to figure out the List<> bcs some idiot at the api decided to put the info in a list-dict with only one list item.

slate swan
#

ok, so i heard there's no such thing as boost events, but there's ghetto workarouns, so how would i be able to detect when a member boosts 2 times?

vale wing
#

The "golden standard" are apache http (or whatever it is named), OkHTTP, retrofit and I think Spring

#

Btw have you tried to build a discord bot with java ๐Ÿ˜‚

halcyon onyx
#

@vale wing how can i pass client into a cog

junior verge
#

How do I fix this?

halcyon onyx
#

for client event

vale wing
#

Did you find a tutorial?

halcyon onyx
#

yess

vale wing
#

Could you link me it

junior verge
halcyon onyx
junior verge
#

oh no

#

lucas

halcyon onyx
#

i cant use client.event

vale wing
#

@commands.Cog.listener()

flint isle
halcyon onyx
#

oh thanks

vale wing
#

Or subclass the bot for specific events

#

I should create a normal tutorial like fr

flint isle
#

would it be @thorny zodiacnake.SlashCommand.add_option()

jagged adder
#

what piece of code (and where) would i need to write to be able to generate a list of all Inventory items which are set as "Yes"(True)
OR
what code should i replace to get the same effect as im after above?

class Inventory:
    Gold_Serpent_Ring = "No"
    Bag_Gold_Coins = "No"
    Start_Scroll = "No"
    SJ_Sword = "No"

@bot.event
async def on_message(message):
    global Location
    global Inventory

if Location == Location.A1S1_OPEN_CHEST:
        if message.content.upper() == "A":
            Location = Locations.A1S1_START_ROOM
            
        elif message.content.upper() == ["B", "C", "D", "E"]:
            Location = Locations.A1S1_LOOTED_CHEST
            CHEST_CONTAINS_ITEM = "No"
            if message.content.upper() == "B":
                Inventory.Gold_Serpent_Ring = "Yes"
            elif message.content.upper() == "C":
                Inventory.Bag_Gold_Coins = "Yes"
            elif message.content.upper() == "D":
                Inventory.Start_Scroll = "Yes"
            elif message.content.upper() == "E":
                Inventory.Gold_Serpent_Ring = "Yes"
                Inventory.Bag_Gold_Coins = "Yes"
                Inventory.Start_Scroll = "Yes"
        else:
            await message.channel.send("You can't do this. Try again.")
            
            return
regal pulsar
#

hello

jagged adder
#

hopefully an example helps more than before :l

slate swan
#

hi

#

can someone help me fix this

#

Traceback (most recent call last):
File "main.py", line 1, in <module>
from discord.ext import commands
File "/home/runner/Trade-Message-Sender/venv/lib/python3.8/site-packages/discord/init.py", line 25, in <module>
from .client import Client
ImportError: cannot import name 'Client' from 'discord.client' (/home/runner/Trade-Message-Sender/venv/lib/python3.8/site-packages/discord/client.py)

halcyon onyx
#

huh import discord.client?

vale wing
jagged adder
#

u speak technical lol
u mean class variables?

vale wing
#

Yes

jagged adder
#

static meaning what..

vale wing
#

Cause it breaks the async principle

vale wing
#

Seems like you don't use instances

jagged adder
#

probably not

vale wing
#

And your class is sort of an enum but it is not constant

jade tartan
jagged adder
#

my code has lots of lengthy bits coz idk the terminology to shorten em

slate swan
potent spear
jade tartan
potent spear
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

halcyon onyx
# slate swan ?

you dont have to import client just do this : client = commands.Bot(command_prefix = sign)

potent spear
#

did you copy paste code?
selfbots aren't supported my guy

jade tartan
#

It still wont work

potent spear
#

what did you change?

jade tartan
potent spear
#

and you changed the params of on_member_join too?

cloud dawn
#

I'm wet

potent spear
#

is it raining at your place too?

cloud dawn
#

Yes

kindred epoch
potent spear
#

explains a lot

oblique laurel
vale wing
#

@jagged adder well maybe this is what you are looking for

class Inventory:
    i_some_nice_item1 = False
    i_another_nice_item1 = False

for i in dir(Inventory):
    if i.startswith("i_"):
        setattr(Inventory, i, True)```
cloud dawn
#

You know how heavy my fur is now

vale wing
#

Weird thing yeah

cloud dawn
vale wing
#

Yes enums are good but I never used them for setting

cloud dawn
jagged adder
#

i used an enum for my locations

class Locations(Enum):
    A1S1_START_ROOM = auto()
    A1S1_OPEN_CHEST = auto()
    A1S1_LOOTED_CHEST = auto()
    A1S1_LOOTED_CHEST_RNG = auto()
    A1S2_TRAPPED = auto()
    A1S2_TRAPPED_DIALOGUE = auto()
    A1S2_TRAPPED_REMAINS = auto()
    A1S2_TRAPPED_RUNES = auto()
    A1S3_HALLWAY = auto()
    DEATH = auto()
vale wing
#

Tbh I doubt this is a good idea to store such items

#

Dict is better

jagged adder
#

but i still dont know how to pull a list :l

cloud dawn
potent spear
#

dataclasses be like

vale wing
#

It's simple key-value

potent spear
cloud dawn
#

I'd make a dict + a class.

potent spear
#

it's a List[Location] that you're most likely looking for

#

where Location is an Enum

cloud dawn
#

Group them

potent spear
#

though that's not very user friendly

jagged adder
#
class Inventory:
    Gold_Serpent_Ring = "No"
    Bag_Gold_Coins = "No"
    Start_Scroll = "No"
    SJ_Sword = "No"

is it still an enum if the word aint there

potent spear
#

mhm, if you have subcommands, sure
but for 1 command, a space? just shorten it and explain in the help command I'd say

potent spear
cloud dawn
#

Can't link up doc rn I'm on phone

vale wing
jagged adder
potent spear
jagged adder
#

yeah i could do that but didnt see why tbh

jagged adder
potent spear
#

just check out documentation of dataclasses, since that's most likely what you want

#

also, not related to this channel

jagged adder
#

would u just type it as

class Inventory:
    Gold_Serpent_Ring = False
    ```
or somethin
#

that just looks wrong

potent spear
#

it's not a about the looks

#

it's about the functionality

flint isle
#

umm when im adding a slash commands option via @thorny zodiacnake.SlashCommand.add_option() does it go before or after the async def

jagged adder
#

ye is that how it'd be typed out tho

potent spear
#

it's False

jagged adder
#

ah

flint isle
#

is this right


    @commands.slash_command(name="remove reaction", guild_ids=config)
    @disnake.SlashCommand.add_option()
    async def
slate swan
#

wait what

#

!d disnake.Option

unkempt canyonBOT
#

class disnake.Option```
Represents a slash command option.
slate swan
#

^

jade tartan
slate swan
#

!d discord.ButtonStyle.PRIMARY

unkempt canyonBOT
#
Out of the question.

No documentation found for the requested symbol.

slate swan
#

wtf

#

wait

jade tartan
slate swan
#

!d discord.ButtonStyle.primary

unkempt canyonBOT
slate swan
#

yeah its blurple

slate swan
#

correct

warped mirage
#

Guys I coded a level system but I get one error can someone check code soon and correct it ? Iโ€™ll send code soon

#

Bruh not level system

#

warning system ๐Ÿ‘€

slate swan
#

and btw, dont follow glowstik for levelling ๐Ÿ˜”

warped mirage
maiden fable
slate swan
slate swan
#

I mean, imagine creating two tables, one for storing xp and one for level....

jade tartan
slate swan
jade tartan
#

Nope alright am done

slate swan
#

where is timeout defined?

slate swan
jade tartan
# slate swan huh?
    async def on_member_join(self, member, Role: discord.Role, ctx):
        role = member.guild.get_role(832120561848156180)
        guild = self.client.get_guild(730651046459998218)
        channel = discord.utils.get(
            member.guild.channels, id=885464532959526913)
        if guild:
            print("guild ok")
        else:
            print("guild not found")

        if channel is not None:
            Myembed = discord.Embed(title=f"Welcome",
                                    description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
            Myembed.add_field(name="Account Created at:",
                              value=f"<t:{int(member.created_at.timestamp())}:R>", inline=True)
            await channel.send(embed=Myembed)
            await member.add_roles(role)
        else:
            print("id channel wrong")``` Is that it?
slate swan
#

pffttt

jade tartan
#
    async def on_member_join(self, member, Role: discord.Role, ctx):
        role = member.guild.get_role(832120561848156180)
        guild = self.client.get_guild(730651046459998218)
        channel = discord.utils.get(
            member.guild.channels, id=885464532959526913)
        if guild:
            print("guild ok")
        else:
            print("guild not found")

        if channel is not None:
            Myembed = discord.Embed(title=f"Welcome",
                                    description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
            Myembed.add_field(name="Account Created at:",
                              value=f"<t:{int(member.created_at.timestamp())}:R>", inline=True)
            await channel.send(embed=Myembed)
            await member.add_roles(role)
        else:
            print("id channel wrong")```
slate swan
maiden fable
#

I'mma go

slate swan
#

!d discord.on_member_join as hunter said

unkempt canyonBOT
#

discord.on_member_join(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") joins a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild").

This requires [`Intents.members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
maiden fable
#

And yea, role too

jade tartan
#

So is that right?

slate swan
#

im going blind

#

.....again

jade tartan
slate swan
#

Role and ctx are invalid....

#

the event only accepts one paremeter

jade tartan
#
    @commands.Cog.listener()
    async def on_member_join(self, member):
        role = member.guild.get_role(832120561848156180)
        guild = self.client.get_guild(730651046459998218)
        channel = discord.utils.get(
            member.guild.channels, id=885464532959526913)
        if guild:
            print("guild ok")
        else:
            print("guild not found")

        if channel is not None:
            Myembed = discord.Embed(title=f"Welcome",
                                    description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
            Myembed.add_field(name="Account Created at:",
                              value=f"<t:{int(member.created_at.timestamp())}:R>", inline=True)
            await channel.send(embed=Myembed)
            await member.add_roles(role)
        else:
            print("id channel wrong")
slate swan
#

yeah

jade tartan
#
    async def on_member_join(self, member: discord.Member, ctx):
        role = discord.utils.get(ctx.guild.roles, name="Unverified")
        guild = self.client.get_guild(730651046459998218)
        channel = discord.utils.get(
            member.guild.channels, id=885464532959526913)
        if guild:
            print("guild ok")
        else:
            print("guild not found")

        if channel is not None:
            Myembed = discord.Embed(title=f"Welcome",
                                    description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
            Myembed.add_field(name="Account Created at:",
                              value=f"<t:{int(member.created_at.timestamp())}:R>", inline=True)
            await channel.send(embed=Myembed)
            await member.add_roles(role)
        else:
            print("id channel wrong")```
wet crystal
#

guys

jade tartan
#

?

wet crystal
#

I heard something about discord.py has been shut down since april 22?

#

what does that mean

#

and some dude told me to switch to nextcord

#

im confused

jade tartan
#

ohh it only passed member var

slate swan
slate swan
jade tartan
#

No error tho

#

So

#

idk

wanton cipher
#

is there a way to convert a discord time to a datetime?

quaint epoch
placid skiff
wanton cipher
placid skiff
#

that method is similar to strftime

#

!d discord.utils.format_dt

unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
placid skiff
#

you find everything in the docs

wanton cipher
#

yes, but, how do I make it a datetime?

placid skiff
#

wdym?

wanton cipher
#

it's a string/int/float, how do I make it a datetime object? (sorry if this is a newbie question)

warped mirage
placid skiff
#

!d datetime.datetime this is the datetime class

unkempt canyonBOT
#

class datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0)```
The *year*, *month* and *day* arguments are required. *tzinfo* may be `None`, or an instance of a [`tzinfo`](https://docs.python.org/3/library/datetime.html#datetime.tzinfo "datetime.tzinfo") subclass. The remaining arguments must be integers in the following ranges...
warped mirage
#

btw , how can someone counterfeit ur bot?

placid skiff
#

you create a datetime object just like you create a class

warped mirage
wanton cipher
#

I think I found another method though... strptime, I might try that...

warped mirage
#

If someone knows my error lemme know

slate swan
#

how can u make a different cooldown for each role in same command?

wanton cipher
wanton cipher
warped mirage
#

Guys

#

manage_members is a invalid permission , what should I do

slate swan
#

its a permission in 2.0

warped mirage
#

How can I change it for another version

#

Like what would it be

slate swan
#

update using git

halcyon onyx
#

hey

#

any one help?

#

why i cant call function from command?

rocky hornet
#

is message.reactions not updated?

#

do i have to refetch the message to see actual reaction count

rocky hornet
halcyon onyx
#

i tryid both

rocky hornet
#

you should await self.my_bg_task()

#

tho if its a repeated task, d.py has a special decorator for those

halcyon onyx
#

thanks!!๐Ÿ’–

rocky hornet
#

@discord.ext.tasks.loop

#

look up more on that in the docs

halcyon onyx
rocky hornet
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with
optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
fresh notch
#

how can i make a ping command?

river vigil
#

how to i make my discord bot active

warped mirage
#
  File "C:\Users\Dom\Desktop\beta test\bot.py", line 37, in on_ready
    lines = await file.readlines()
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\aiofiles\threadpool\utils.py", line 45, in method
    return (yield from self._loop.run_in_executor(self._executor, cb))
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
io.UnsupportedOperation: not readable``` how can i fix this
river vigil
#

๐Ÿคท

rocky hornet
#

how to refetch a message

slate swan
rocky hornet
#

it doesnt do that automatically

warped mirage
rocky hornet
#

pls help

warped mirage
#

so my warns work , viewwarns work

#

i need help coding delete warns , can u help me with that?

slate swan
slate swan
rocky hornet
#

what is this response..

warped mirage
regal pulsar
#

what type of file are you reading

slate swan
warped mirage
#

bro i already fixed it

regal pulsar
#

oh

slate swan
warped mirage
#

i needed to add the mode as = r

warped mirage
#

and it sends as a txt

slate swan
regal pulsar
#

lmao

slate swan
#

what

regal pulsar
#

disnake is my database

rocky hornet
warped mirage
#

shall i send my code , u can see what i mean

regal pulsar
#

along with aiohttp

#

and asyncio

slate swan
warped mirage
regal pulsar
#

which comes with the updated reaction count

slate swan
warped mirage
#

can u help me fix my thing then lol

#
  • remove warns
slate swan
regal pulsar
regal pulsar
slate swan
regal pulsar
#

use mongo

warped mirage
slate swan
#

no mongo is under-powered

regal pulsar
#

typing is slow

regal pulsar
rocky hornet
warped mirage
#

...

slate swan
# warped mirage can i use a json database , i cba using aiosqlite its too much work

json files might look easy at one hand, and sweet to use on the other, thats why you cut both of them off and use sqlite, because json is fine for config files and has slower reads and writes than a database and this may result in loss of data while reading writing, thats the reason why we tell you to use a database, sqlite, would be by far the easiest

regal pulsar
#

what

slate swan
#

imagine sql

#

!d discord.abc.Messageable.fetch_message

unkempt canyonBOT
#

await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message") from the destination.
rocky hornet
#

i guess its safe to assume its in cache

regal pulsar
#

oops

slate swan
warped mirage
#

xd

rocky hornet
slate swan
slate swan
warped mirage
#

@slate swan I can create a table but rest I need help with tbf

slate swan
#

yes, since the message that was sent is stored in the variable and the cache

slate swan
slate swan
rocky hornet
slate swan
#

ah well that should be fine since they might be cacheing reactions as well, if it doesn't work then use fetch

#

In disnake u have one

slate swan
rocky hornet
#

alright thanks love ya

slate swan
#

everybody loves Sarthak โค๏ธ

slate swan
warped mirage
#

Ok Iโ€™ll check it out

slate swan
slate swan
#

even though its usable

#

but you shouldnt

warped mirage
#

Not copying tho

#

Iโ€™ll use my code

slate swan
#

it totally depends on how you want your data structure to be, what items you want to store..

warped mirage
#

So itโ€™s possible ?

slate swan
#

it indeed is

warped mirage
#

Btw can u help me setup a cog rq or nah thatโ€™s all Iโ€™m asking for I guess

slate swan
#

you can call it from anywhere, with proper args

warped mirage
#

Like the things it requires

warped mirage
#

huh

slate swan
#

what library are you using to make the Bot

warped mirage
#

client

slate swan
#

lemme take take it to more basic level, what did you pip install, and import

#

Lmao

warped mirage
#

discord.py โ€ฆโ€ฆ. import discord
from discord.ext import commands โ€ฆ. Good enough?

slate swan
#

Ye

#

exactly what they asked for

warped mirage
#

Ok

slate swan
flint isle
#
@commands.slash_command(name="removereaction", guild_ids=config)
    @disnake.SlashCommand.add_option(name='emoji',description="Which Emoji's Reaction should be cleared", required=True, choices=['Checkmark','furheart', 'both'])
    async def rmreaction(self, ctx, amount: int = None):

but its returning the error

disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: TypeError: SlashCommand.add_option() missing 1 required positional argument: 'self'
slate swan
#

bot = commands.bot

flint isle
#

omg i just sucessfully bypassed the proxy on the network :).

warped mirage
slate swan
#

No

warped mirage
#

Yes

warped mirage
#

@bot.command just doesnโ€™t look cool โ€ฆ @client.command much better ngl

slate swan
#

Huh

#

Weird

flint isle
#

or at least tell me what spot it goes XD

slate swan
#
@commands.slash_command(name="removereaction", guild_ids=config)
    @disnake.SlashCommand.add_option(self,name='emoji',description="Which Emoji's Reaction should be cleared", required=True, choices=['Checkmark','furheart', 'both'])
    async def rmreaction(self, ctx, amount: int = None):โ€Š
#

Maybe

flint isle
#

i will try that and dispatch back here

warped mirage
#

Wait I just checked ur code @slate swan , so u do aiosqlite.connect(db) or whatever so for my level system it was level.db , do I just make a new db and call it warn.db like would that work .

slate swan
#

Ok

warped mirage
#

A new file in other words

warped mirage
#

Ok .

slate swan
#

huh

#

Nvmd

slate swan
# warped mirage discord.py โ€ฆโ€ฆ. import discord from discord.ext import commands โ€ฆ. Good enough?
#Assuming this is example_cog.py

from discord.ext import commands
import discord

class ExampleCog(commands.Cog):
  def __init__(self, bot: commands.Bot):
    self.bot = bot #self.bot will represent a Bot object inside a cog and you can use it for all options that are only available with Bot
  
  @commands.command() # a Command decorator but in a cog
  async def ping(self, ctx: commands.Context):
    await ctx.send("pong")

  @commands.Cog.listener("on_message") #an event but in a cog
  async def on_message(self, message: discord.Message):
     await message.reply("uwu")

def setup(bot: commands.Bot): #this method is async in 2.0
  bot.add_cog(ExampleCog(bot)) #this method has to be awaited in 2.0

you can only use cogs if you are using Bot or subclassing Bot since you have to load cogs as extensions and load_extension is a method of the Bot class and not the Client class

warped mirage
#

I used client and it worked before tbf so Iโ€™ll try use that

flint isle
slate swan
#

No

warped mirage
#

Btw @slate swan I donโ€™t use 2.0 I think . Is there a way to check what v I have

slate swan
slate swan
warped mirage
#

Ok ima check

stray carbon
#

Hi so, how do we store List in MySql database?

warped mirage
slate swan
#

sure

stray carbon
warped mirage
slate swan
stray carbon
#

oh

slate swan
stone beacon
#

Does't sql have an array type?

warped mirage
#

It was by accident sos

slate swan
stray carbon
warped mirage
# slate swan it doesnt

Are u like very good with py , I see ur coding Js do u like know python very well and same with js or like how lol Iโ€™m a bit curious How long did it take u to learn this stuff and if ur advance maybe some tips for people who wanna be better uknow

slate swan
warped mirage
#

2020

stone beacon
#

I used it like last week

flint isle
#

@slate swan should i move the option to after the definition?

stone beacon
#

But it's weird

slate swan
slate swan
stone beacon
#

Time to get offtopic'd

stone beacon
flint isle
slate swan
flint isle
#

disnake

warped mirage
slate swan
weak moat
#

Hello everyone, can you tell me how to make an anti-raid system?

slate swan
unkempt canyonBOT
#

class disnake.Option```
Represents a slash command option.
flint isle
slate swan
flint isle
slate swan
#

If small we can

#

But it's big

warped mirage
#

Jk

weak moat
slate swan
warped mirage
weak moat
slate swan
slate swan
slate swan
slate swan
tiny ibex
#

Since when did that become a thing?

slate swan
slate swan
tiny ibex
slate swan
flint isle
slate swan
# warped mirage AIOSQLITE

its totally your choice though, you could use a json-based cloud db such as mongodb (not recommended) or deta (https://www.deta.sh) (might recommend at some point)

slate swan
#

oh sowwy

#

its disnake.Option.add_option

#

at least that worked for me

#

Ye

#

otherwise im out

warped mirage
#

Can someone recommend me what other systems I can code after warning

slate swan
#

!d disnake.Option.add_option

unkempt canyonBOT
#

add_option(name, description=None, type=None, required=False, choices=None, options=None, channel_types=None, autocomplete=False, min_value=None, max_value=None)```
Adds an option to the current list of options, parameters are the same as for [`Option`](https://docs.disnake.dev/en/latest/api.html#disnake.Option "disnake.Option").
warped mirage
#

Or options

flint isle
# slate swan hm weird

disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: TypeError: Option.add_option() missing 1 required positional argument: 'self'

slate swan
slate swan
flint isle
#

lol the issue is it wants self ;w;

slate swan
#

๐Ÿ˜”

#
@bot.slash_command(name="name", options =[ disnake.Option(*args) ... ])
#

wtf

#

weird syntax ๐Ÿ˜”

#

hikari โค๏ธ ๐Ÿ˜”

#

i agree

#

thats the old Disnake syntax btw

#

old disnake

unkempt canyonBOT
#

examples/slash_commands/param.py lines 42 to 55

# Options can also be added into the docstring
@bot.slash_command()
async def full_description(
    inter: disnake.CommandInteraction,
    user: disnake.User,
    channel: disnake.TextChannel,
):
    """A random command

    Parameters
    ----------
    user: A random user
    channel: A random channel
    """```
slate swan
#

you can simply typehint args now

#

thats a thing from a long time ago....isnt it?

ionic garden
#

so i just ran the same discord bot script multiple times
once in my ide, and once in my terminal
and nothing errored
what the heck?

weak moat
slate swan
ionic garden
#

same token, i expected some sort of conflict

slate swan
ionic garden
#

oh it just executes the same function 2 times lol

slate swan
slate swan
#

yep

#

weird

wraith lion
#

do anyone know any meme and nsfw apis

slim crag
#

I have a discord username how can I get the user id;

vocal plover
#

its too good to change

slate swan
#

how can i start cooldown for user if a condition is met ?

#

what the heck is a guild's welcome screen now

#

How do i make slash commands have arguments that arent required

#

argument= None

slate swan
#

rly? lol

#

yes ๐Ÿ’€

spring flax
slate swan
spring flax
#

making it optional (arg=None) doesn't remove the argument when using the slash commands, the user can just skip that argument without inputting anything

slate swan
#

i legit just switched to pycord for easier slash commands

#
@bot.slash_command(guild_ids=[":troll:"], description="Meth command lol")
async def meth(ctx, user: discord.User = None):
  #code!1!!

spring flax
slate swan
slate swan
#

because we LOVE py-cord

slate swan
#

dont

#

ever
say
that
again

cloud dawn
slate swan
maiden fable
#

!src d

unkempt canyonBOT
#
Command: docs

Look up documentation for Python symbols.

Source Code
slate swan
#

Ok how tf do i get the author of a slash command ๐Ÿ’€

#

!d discord.Interaction.user

unkempt canyonBOT
slate swan
#

Why donโ€™t they just make it easier

#

Like what is the actual point of putting user other than author

#

Why have them different

maiden fable
#

Weird but Danny's wish

slate swan
#

God I love and hate Danny

#

Ok

maiden fable
#

!d

unkempt canyonBOT
flint isle
#

@slate swan i found this in the documentation
options (List[Option]) โ€“ The list of sub options. Normally you donโ€™t have to specify it directly, instead consider using @main_cmd.sub_command or @main_cmd.sub_command_group decorators.

maiden fable
#

Yo @slate swan do u know where the Python bot stores all doc urls?

flint isle
#

!d source

unkempt canyonBOT
#

source expression```
Try to get source code for the given object and display it.

New in version 3.2.
flint isle
#

lmao not what i wanted

maiden fable
#

!src e ?

unkempt canyonBOT
#
Command: eval

Run Python code and get the results.

Source Code
flint isle
#

!src !d

unkempt canyonBOT
#
Bad argument

Unable to convert '!d' to valid command, tag, or Cog.

#
Command Help

!source [source_item]
Can also use: src

Display information and a GitHub link to the source code of a command, tag, or cog.

unkempt canyonBOT
#
Command: docs

Look up documentation for Python symbols.

Source Code
maiden fable
#

Weird it shows source and whatis in the docs but they ain't keywords

#

Oh nvm

flint isle
#

how do I turn on wordwrap for a file in pycharm

maiden fable
flint isle
#
                                                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Andy\PycharmProjects\WhiskeyBotMain\wb.py", line 45, in <module>
    bot.load_extension('cogs.events')
  File "C:\Users\Andy\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 487, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\Users\Andy\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 419, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='? (events.py, line 51)

code:

    @commands.slash_command(name="removereaction", guild_ids=config, options=["option_name", choices=['checkmark','furheart','both'], required=True])
maiden fable
#

Uh

#

u have everything inside the options kwarg.....?

flint isle
#

yeah. i think so

maiden fable
#

I mean that is the issue lol

slim crag
#

I have a discord username how can I get the user id;

flint isle
glad cradle
#

what is the alternative to not using a local error handler?

maiden fable
maiden fable
#

U were missing a bracket lol

flint isle
flint isle
slate swan
#
@client.command()
async def scratch(ctx):

    users = await get_bank_data()
    user = ctx.author

    b1 = Button(style=discord.ButtonStyle.grey, label="Scratch")
    b2 = Button(style=discord.ButtonStyle.grey, label="Scratch")
    b3 = Button(style=discord.ButtonStyle.grey, label="Scratch")
    b4 = Button(style=discord.ButtonStyle.grey, label="Scratch")
    b5 = Button(style=discord.ButtonStyle.grey, label="Scratch")
    b6 = Button(style=discord.ButtonStyle.grey, label="Scratch")
    b7 = Button(style=discord.ButtonStyle.grey, label="Scratch")
    b8 = Button(style=discord.ButtonStyle.grey, label="Scratch")
    b9 = Button(style=discord.ButtonStyle.grey, label="Scratch")
    b10 = Button(style=discord.ButtonStyle.grey, label="Scratch")
    b11 = Button(style=discord.ButtonStyle.grey, label="Scratch")
    b12 = Button(style=discord.ButtonStyle.grey, label="Scratch")

    view = View()
    view.add_item(b1)
    view.add_item(b2)
    view.add_item(b3)
    view.add_item(b4)
    view.add_item(b5)
    view.add_item(b6)
    view.add_item(b7)
    view.add_item(b8)
    view.add_item(b9)
    view.add_item(b10)
    view.add_item(b11)
    view.add_item(b12)
    await ctx.send("Scratch! Scratch! Scratch!", view=view)

Why isn't this showing the buttons when I run !scratch?

glad cradle
slate swan
#

so i will do view2 view 3 or something?

glad cradle
#

are u using disnake?

#

or it's dpy?

slate swan
#

nope

#

dpy

#

@glad cradle help

glad cradle
#

idk for dpy

slate swan
#

..

glad cradle
#

ik for disnake

#

try to ask in the dpy server

slate swan
#

link?

maiden fable
silk mauve
#

Is there something to repeat a message or something

#

Like the message keeps sending

slate swan
#

just use a loop

maiden fable
#

and get ready for getting ratelimited!

slate swan
#

you can use a task or just a python loop

halcyon onyx
#

hello

#

any one know how i call the function in here/

slate swan
#

why a task?

halcyon onyx
#

i want it to loop it every one minute runs

slate swan
#

you can just use a task.loop

halcyon onyx
#

im using cogs and idk how

slate swan
#

its probably the same

halcyon onyx
#

do u know how to do it on classes

slate swan
#

well its probably all the same just with the self argument

halcyon onyx
#

like this?

#

and how i call it now

#

like this

#

or this

brave forge
#

What is the reason for this error?
discord.errors.ExtensionFailed: Extension 'cogs.economy' raised an error: ImportError: cannot import name 'cursor' from 'psycopg2' (C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\psycopg2\__init__.py)

warped mirage
#

@slate swan btw my version is 1.7.3

pallid meadow
#

Specifically the psycopg2 one

slate swan
#

whats psycopg2

pallid meadow
#

Double check that import

slate swan
pallid meadow
#

For Postgres

slate swan
#

does it have a cursor function/file ?

pallid meadow
#

Yeah

#

It should at least, would be a pretty bad orm if you couldnโ€™t run raw sql as most allow you to

brave forge
#

@pallid meadow and what to do ?

slate swan
#

a cursor without an connection doesnt sound like a good idea

pallid meadow
slate swan
pallid meadow
#

Because if not just get rid of the import

warped mirage
#

is that very bad?

slate swan
slate swan
warped mirage
#

or probs use newest version but on 1.7.3 idk

slate swan
#

weird, you use a bad outdated third party library

warped mirage
#

ok

slate swan
#

didn't you?

warped mirage
#

btw i set up a cog file , how do i import it into main.py

warped mirage
slate swan
#

why would you import a Cog in your main file?

warped mirage
#

...... so that the cog file works

slate swan
#

thats not how it works.

#

!d discord.ext.commands.Bot.load_extension

unkempt canyonBOT
#

await load_extension(name, *, package=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Loads an extension.

An extension is a python module that contains commands, cogs, or
listeners...
warped mirage
#

Ye u need that

slate swan
#

so suppose you have a cog file named "test.py", you gotta do bot.load_extension("test") , thats it.

slate swan
warped mirage
#

Ok does it matter where I place it

wet crystal
#

Hey,
Does anybody know if its necessary to add the guild_ids at the end of this?
Also can you have just a integer instead of a list?

@bot.slash_command(name="embed", description="Create a custom Embed!", guild_ids=[123456789])
warped mirage
#

Check sqlite3 docs

odd mango
#

i want to EXPORT all errors (red text) FROM my REPL CONSOLE to a discord channel as a .txt file

anyone knows how?

warped mirage
#

why txt file lol

#

Use html if anything tbf

brave forge
odd mango
#

cause they can be long as hell

warped mirage
odd mango
warped mirage
odd mango
#

how do i do it

brave forge
tough lance
warped mirage
#

U would have to do probs a if statement and add if error or smth then await channel.send(error)

#

@odd mango something like that

brave forge
odd mango
warped mirage
odd mango
#

got references?

shrewd apex
warped mirage
#

Not really Iโ€™m not the best here but I give advice to what I would do tbf

shrewd apex
#

yt tutorials aren't exactly the best out there

odd mango
#

yeah

warped mirage
#

Does it job for beginners

tough lance
#

@odd mango you can use this to get the error

brave forge
odd mango
#

i tried searching but all were over the head

warped mirage
#

If there is any doc that is bad โ€ฆ.. then it will go to databases

shrewd apex
#

no it says wrong stuff then u try to fix it it's too late for that coz u prolly followed the tutorial and ur code base is a bit too big

shrewd apex
odd mango
#

i wanna get all the red text out

tough lance
#

It will get the red text out

shrewd apex
#
try:
     #your code
except Exception as e:
     raise e
brave forge
#

discord.errors.ExtensionFailed: Extension 'cogs.economy' raised an error: ImportError: cannot import name 'cursor' from 'psycopg2' (C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\psycopg2\__init__.py)
how can I fix this error ? I am using a sqllite3 database.
And I don't need to send a link to the python documentation. I don't understand this stupid documentation

slate swan
#

Can i get the joinmsg.id from this?

                 joinmsg = await c.send("<@&958757033119744010>", embed=req_embed, view=join_ticket())
shrewd apex
odd mango
tough lance
slate swan
odd mango
shrewd apex
odd mango
#

i dont need command error handlers, already have those

brave forge
odd mango
#

yea

brave forge
slate swan
slate swan
shrewd apex
#

nothing much we can do abt too many requests error since that is returned response from the api u are calling

#

repl i am not too sure i use heroku to host

odd mango
odd mango
#

i am asking for wanting to EXPORT all errors (red text) FROM my REPL CONSOLE to a discord channel as a .txt file

#

or any sort of readable file

slate swan
#

what event are you using for that

odd mango
slate swan
#

!d discord.on_error this is raised whenever an error happens

unkempt canyonBOT
#

discord.on_error(event, *args, **kwargs)```
Usually when an event raises an uncaught exception, a traceback is
printed to stderr and the exception is ignored. If you want to
change this behaviour and handle the exception for whatever reason
yourself, this event can be overridden. Which, when done, will
suppress the default action of printing the traceback.

The information of the exception raised and the exception itself can
be retrieved with a standard call to [`sys.exc_info()`](https://docs.python.org/3/library/sys.html#sys.exc_info "(in Python v3.10)")...
slate swan
#

save the error in your file..

odd mango
#

you see, to go run kill 1 i need to know when the bot gets the error, so i need to upload it in a discord channel as a file with a ping so that i can go and re run the repl

odd mango
slate swan
#

bruh, i want to see the imports not your listener

slate swan
odd mango
odd mango
#

not rate limit or whatever

slate swan
#

you will never get ratelimit errors raised with an event ๐Ÿšถโ€โ™‚๏ธ

#

use python logging module to save this

odd mango
#

yes how

odd mango
slate swan
brave forge
odd mango
slate swan
brave forge
#

@slate swan use the buttons better

#

yes

glad cradle
#

you wrote cxt in the parameters of the function

slate swan
#

๐Ÿšถโ€โ™‚๏ธ its not a context tho, its an interaction

#

unless youre using something like pyc~

tough lance
#

Heh

slate swan
brave forge
warped mirage
#

guys can someone help me make my code into a cog + aiosqlite file

slate swan
odd mango
#

like with a block

warped mirage
#

guys if i send my code can someone help convert it , it will be quite alot i guess but any help works

desert heart
#

You should first try it on your own, and then come back if you have any specific questions regarding that.

odd mango
#

oh wait i tried that logging, but it was A LOT OF TEXT, it had everything except the error itself so i gave up

warped mirage
desert heart
#

You mean you were saving data to files but you want to save it to sqlite instead?

slate swan
warped mirage
odd mango
#

none did the desired

tough lance
desert heart
#

To use sqlite you'll need to be familiar with SQL and with relational database concepts. So I suppose that would be the first thing for you to research before you start writing code/converting your code.

#

There is a #databases channel if you have specific questions about those topics

tough lance
#

Don't worry SQL isn't that hard.

warped mirage
#

well i know some sql since i used it for my leveling system , should i look back at it and just remake it into a warn system i guess

#
async def setup_db():
    client.db = await aiosqlite.connect("level.db")
    await client.db.execute(
        "CREATE TABLE IF NOT EXISTS levels (level INTEGER, xp INTEGER, user INTEGER, guild INTEGER)")
    await client.db.execute(
        "CREATE TABLE IF NOT EXISTS levelSettings (levelsys BOOL, role INTEGER, levelreq INTEGER, guild INTEGER)")
    await client.db.commit()
``` like i know how to make this stuff
tough lance
#

Yes but the schema isn't good

warped mirage
#

ik but it does the job for now

tough lance
#

You should research on that

warped mirage
#

btw ```py
from discord.ext import commands
import discord

class warning(commands.Cog):
def init(self, client: commands.Bot):
self.client = client

@commands.command()
async def ping(self, ctx: commands.Context):
await ctx.send("pong")

@commands.Cog.listener("on_message")
async def on_message(self, message: discord.Message):
await message.reply("Yo")

def setup(client: commands.Bot):
client.add_cog(warning(client))``` i have this as a cog , what should i do in main.py to like import it or whatever

#

i havent used cogs in a while so im just getting used to it

tough lance
#

You can add it by bot.add_extension("filename.py")

warped mirage
#

oh lmao i added a await thats why it didnt work

#

btw is there a certain location in the file i have to place it in or can it be anyone . like above client.event or whatever

odd mango
#

okay so what i want is
if there is any red text in my console (not just command errors), i want my program to copy paste it in a discord channel as a FILE

h o w d o i d o t h a t

warped mirage
#

I saw that

wet crystal
#

Why doesn't this create a slash command on my discord

async def on_ready():
    print(f'{bot.user} has booted up succesfully!')

class EmbedModal(nextcord.ui.Modal):
    def __init__(self):
        super().__init__(
            "Embed Maker",
        )

        self.emTitle = nextcord.ui.TextInput(Label = "Embed Title", min_Length = 2, max_Length = 124, required = True, placeholder = "Enter Embed Title")
        self.add_item(self.emTitle)

        self.emDescription = nextcord.ui.TextInput(Label = "Embed Description", min_Length = 5, max_Length = 4000, required = True, placeholder = "Enter Embed Description", style = nextcord.TextInputStyle.paragraph)
        self.add_item(self.emDescription)

    async def callback(self, interaction: nextcord.Interaction) -> None:
        title = self.emTitle.value
        desc = self.emDesc.value
        em = nextcord.embed(title=title, description=desc)
        return await interaction.response.send_message(embed=em)

@bot.slash_command(name="embed", description="Create a custom Embed!", guild_ids=[This is the right ID])
async def embed(interaction: nextcord.Interaction):
    await interaction.response.send_modal(EmbedModal())
formal basin
#

Anyone know how to make a twitch notification discord.py?

#

No api

magic ore
halcyon onyx
#

hello
does anyone know how i upscale this photo

digital mason
#

Hello everyone

potent spear
warped mirage
#

Hi

potent spear
#

though some image sizes are fixed in embed probably

warped mirage
#

Can someone give me an idea of what systems can u possibly do apart from economy level warn ticket systems

warped mirage
potent spear
#

everyone in this channel is
if you don't know what to implement next, optimize your current code

warped mirage
#

I made a warning system , but it saves as a txt and I use aiofiles I want to convert this into a aiosqlite db and as a cog at the same time but I need help

potent spear
#

you already have a db, why tf would you save it as a txt?

warped mirage
#

I wanna make a table in a cog if itโ€™s possible

potent spear
#

just make an ainit

warped mirage
#

Itโ€™s quite confusing I know

pallid meadow
#

In theory yes

potent spear
#

just check out an async init => when your cog gets loaded, it'll also make sure the tables for that cog are created

warped mirage
#

I created tables in main.py and my levelling system is in it aswell , but for my warning system I wanna make it in a cog so that itโ€™s not messy or stuff

uncut comet
#

i have a weird issue which spotfiy just wont work anymore is there a way i can test a connection/diagnose a connection issue with spotipy

uncut comet
#

yea idk what channel i tried to ask what channel but no one responded

potent spear
#

one of the "available help channels" category

uncut comet
#

okay will do

placid skiff
potent spear
#

ofc you can

placid skiff
potent spear
#

!d discord.CategoryChannel.edit

unkempt canyonBOT
#

await edit(*, reason=None, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the channel.

You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to
use this...
placid skiff
#

you will just have to do this <#category_channel_id>

#

you can do this with voice channel to

potent spear
#

get the category channel, via get_channel, then just use the method above and and the correct args

terse coyote
#

how to remove command "help"?

potent spear
#

try and see

potent spear
#

try and see

#

ofc

warped mirage
#

Guys Iโ€™ll send my code and can someone help me make it into a sqlite in a cog or if not any ideas cuz I create tables in main py but I wanna make tables in cogs aswell and how to import it or whatever

hasty chasm
#

where can i find the unicode for d.py all the ones i find dont work for the emoji

weak moat
#

Can you tell me how to turn off the user's microphone through the bot?

terse coyote
#

how to write member's roles in descending order?

potent spear
unkempt canyonBOT
weak moat
#

Thanks

potent spear
formal basin
#

Anyone know How I can make this code to say

if discord.username is โ€œtest_accountโ€:
return

warped mirage
formal basin
#

I just want the real one

potent spear
stone beacon
formal basin
#

What is the real code

potent spear
stone beacon
#

Me tryna understand

potent spear
#

what you actually want to check is if it's not a specific member, the name doesn't matter

stone beacon
#

Firstly fam, the on_member_update gives you two member objects as before,after

unkempt canyonBOT
#

property name```
Equivalent to [`User.name`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.name "discord.User.name")
stone beacon
#

Oho

#

I cannot read

potent spear
stone beacon
formal basin
stone beacon
#

ah

#

Either way

#

!d discord.on_member_update

unkempt canyonBOT
#

discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") updates their profile.

This is called when one or more of the following things change...
formal basin
#

Idk what Iโ€™m doing

stone beacon
# unkempt canyon

before and after are Member objects of the member that was updated.And this is how you get their name

stone beacon
formal basin
stone beacon
formal basin
#

I canโ€™t find any

stone beacon
potent spear
formal basin
stone beacon
#

Twitch has a free api for those stuff

#

Just subscribe to the event for when ppl go live

#

and there must be a wrapper on pypi for the twitch api that you can integrate into your bot

potent spear
stone beacon
#

More painful api's

#

Sayless

#

When things get tuff seek inspiration from an open source github repo lemon_swag

wary belfry
#

Maybe someone here can help me out.
I'm using Pycord and want to add checks to a SlashCommandGroup. In order to do that I need to set the checks kwarg when creating the group. There is actually a quick explanation of how to do it in the docs but I just don't understand it. So can anyone explain to me how exactly I need to define the check kwarg?
Here is the link to the explanation in the docs: https://docs.pycord.dev/en/master/api.html?highlight=slashcommandgroup#discord.SlashCommandGroup.checks
I already tried checks=[commands.is_owner()] and checks=commands.is_owner() and it didn't work.

potent spear
#

these are also decorators

#

@commands.is_owner()

wary belfry
#

oh

formal basin
#

That?

formal basin
#

Not name

potent spear
#

you should know that by now

formal basin
wary belfry
potent spear
#

I hope this clearifies

wary belfry
#

that's not what I want xD
I'm actually talking about command groups

#

like group = bot.create_group(args)

#

In the docs is this List[Callable[[ApplicationContext], bool]] defined as the type to give to the checks argument when creating the group.
And I just don't get what that means... I don't get where the context comes from and why there is a bool...

potent spear
#

just get the len of bot.guilds, bot.members and bot.commands ๐Ÿง 

wary belfry
potent spear
slate swan
#

is that static? or does it update too

potent spear
warped mirage
hasty chasm
#

is it possible to have a command also be a listener
like i want to make a command to send a message and when the reaction is clicked it adds a role
can i do that in one command or does it have to be a command and an event

potent spear
#

because you're doing it again, I'm out

unkempt canyonBOT
#

wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message,
or to react to a message, or to edit a message in a self-contained
way...
hasty chasm
#

alright thank you

warped mirage