#discord-bots

1 messages · Page 1075 of 1

slate swan
#

😭

livid hinge
#

ok lets move on

slate swan
#

yes pls

livid hinge
#

.topic

lament depotBOT
#
**What commands/features are you proud of making?**

Suggest more topics here!

slate swan
#

i was gonna do that

livid hinge
#

o๑p

slate swan
livid hinge
#

i am proud of a chat cmd

slate swan
slate swan
livid hinge
#

oh mine does that +kill

slate swan
#

elaborate so we can copy

slate swan
livid hinge
#

lmao

warped mirage
#

Seems correct to me

slate swan
livid hinge
#

it tells its ip and kills itself

#

good for double-responses

slate swan
slate swan
livid hinge
#

you incapacitate the machine

warped mirage
#

I already closed it but I didn’t add the , at the end yet so I’ll add it

slate swan
slate swan
livid hinge
#

lol

#

self-nuke

slate swan
#

seems fun to do

slate swan
dusky pine
slate swan
#

🏚️

slate swan
dusky pine
#

like (ctx.guild.id, ctx.channel.id, "blah",) :3

heavy shard
#

i made my bot interact with console it was launched from

warped mirage
livid hinge
slate swan
#

😳

heavy shard
#

accepting console commands, to be precise

livid hinge
#

and it explodes

slate swan
slate swan
#

!d os.system

unkempt canyonBOT
#

os.system(command)```
Execute the command (a string) in a subshell. This is implemented by calling the Standard C function `system()`, and has the same limitations. Changes to [`sys.stdin`](https://docs.python.org/3/library/sys.html#sys.stdin "sys.stdin"), etc. are not reflected in the environment of the executed command. If *command* generates any output, it will be sent to the interpreter standard output stream. The C standard does not specify the meaning of the return value of the C function, so the return value of the Python function is system-dependent.

On Unix, the return value is the exit status of the process encoded in the format specified for [`wait()`](https://docs.python.org/3/library/os.html#os.wait "os.wait").
heavy shard
#

the opposite 🙂 getting user input from console

slate swan
livid hinge
#

be sure to vigorously sanitize any user input

heavy shard
#

it was small happy potato acchievement

slate swan
livid hinge
#

it was ok

slate swan
slate swan
livid hinge
heavy shard
#
import aioconsole
inp = await ainput(">")
slate swan
slate swan
dusky pine
#

ah, top-level await lmao

alpine pewter
#

Anyone able to show me an example of how to store user data?
For example, they type /token and it puts the value in a .db or .json?

Or just point me to the right video/article/thing

slate swan
livid hinge
#

ey wait

heavy shard
#

it was pseudo-code 😐

slate swan
#

too bad my python interpreter(my brain) says its invalid😌

livid hinge
#

protip: if you pipe your code into python -m asyncio, you could do top-level await

heavy shard
#

installs patch into okimii's interpreter

livid hinge
#

never actually tried it, YMMV

slate swan
slate swan
livid hinge
#

on a typewriter

slate swan
#

hellish

warped mirage
#

@slate swan my current errors are adding tuples so I’ll do that quickly

slate swan
maiden fable
heavy shard
#

i use linux 😦

slate swan
#

no top level async for you

livid hinge
slate swan
#

ive done it

warped mirage
#

Hey finally bot gives an error

livid hinge
#

sure

warped mirage
#

welcome message is (None,)

slate swan
livid hinge
warped mirage
#

Lemme check

livid hinge
warped mirage
#
 @commands.command()
    async def set_msg(self, ctx):
        async with aiosqlite.connect("wm.db") as db:
            cursor = await db.cursor()
            await cursor.execute("SELECT welcome  FROM wm where guild_id = ?", (ctx.guild.id,))
            data = await cursor.fetchone()

            if not data:
             await cursor.execute("INSERT INTO wm(guild_id, channel_id, welcome) VALUES(?,?,?)", (ctx.guild.id, ctx.channel.id, 'xyz',))
             await db.commit()
             return await ctx.send(f"Welcome message has been set!")
            
            await cursor.execute("SELECT welcome  FROM wm WHERE guild_id = ?", (ctx.guild.id,))
            mesg = await cursor.fetchone()
            if not mesg: return await ctx.send("There is no welcome message currently set.", delete_after = 10)
            return await ctx.send(f"welcome message is {mesg}")``` this is the code idk
slate swan
#

oh wait its 6 am already wtf...

livid hinge
#

!e

import asyncio, os
async def main():
    await os._exit(127)
asyncio.run(main())```
unkempt canyonBOT
#

@livid hinge :warning: Your eval job has completed with return code 127.

[No output]
slate swan
maiden fable
slate swan
livid hinge
#

turned out it was _exit

warped mirage
#

can u help me make it all into one connection

livid hinge
#

smh

maiden fable
slate swan
warped mirage
#

...

slate swan
livid hinge
#

anyone made a bot that can cooperate with other instances of the bot

slate swan
#

shards?

warped mirage
livid hinge
#

kinda yeah

warped mirage
#

xd

slate swan
slate swan
livid hinge
slate swan
#

discord has a system which assigns instances of the same bot to certain guilds which those instances are called shards

livid hinge
#

shards split up the load right? i mean communicate and stuffs

slate swan
livid hinge
#

like, for example, shutting themself down if another one is running

slate swan
warped mirage
#

damn

#

anyways can someone help me make all my connections into 1 . IN a ({COG})

slate swan
#

@livid hinge you can probably check the channels history and then check the 2 recent messages and if theyre from the same author in this case the own bot it just logs out of the gateway and then you just connect again

livid hinge
#

yeah that could work ig

slate swan
#

this would only work with 2 instances tho its a hard coded solution imo and theirs probably a better way

#

i wonder why discord doesnt check the websocket connections

#

because to make a ws handshake you would need to send an IDENTIFY payload with your bot token so why does discord not save the payload and checks for multiple instances of the same payload

warped mirage
#

Ok someone ping me if u can help

livid hinge
#

why not ask here? @warped mirage

slate swan
maiden fable
#

No

#

It's just like running different instances of bot

slate swan
#

we learn new things everyday dont wepithink

glad cradle
#

k

slate swan
#

yas

slate swan
#

Hey everyone i need help making my discord bot there's a error w my code and i need some help

#

How can I rerun the command when the reaction is pressed?

maiden fable
unkempt canyonBOT
#
Not gonna happen.

No documentation found for the requested symbol.

maiden fable
#

Smh

slate swan
#

great bot

dapper tendon
#

Can I make a music bot with dpy 2.0 ?

maiden fable
#

U can but against ToS

slate swan
dapper tendon
slate swan
# dapper tendon How ?

you'll use something like youtube-dl to download the song which is already breaking youtube tos.

maiden fable
#

.source topic

#

Smh

slate swan
#

.source topic

lament mesa
#
{
"t":"event",
"d":...
"op":opcode
"s":s
}``` this is what data received from the discord gateway looks like right?
I suppose `"d"` is the event-related payload, but what is `"op"` and `"s"`?
slate swan
#

@maiden fable basically @bot.commands() isn't working.

maiden fable
#

op is the code sent by the Discord API

slate swan
maiden fable
lament mesa
maiden fable
slate swan
#

Yeah ik

maiden fable
#

This is used for enum purposes, to identify the event

slate swan
#
import discord
from discord.ext import commands
from discord.ext import task

bot = commands.Bot(command_prefix = "/")
bot = commands.Bot(command_prefix="!")
bot = discord.Client()
@bot.command()
async def ping(ctx):
	await ctx.channel.send("pong")
#

I removed my token btw bc of the server

#

Oh I realise now there's a error

slate swan
maiden fable
slate swan
#

But it still dosent work.

maiden fable
warped mirage
#

Yo can someone help me please

slate swan
#

Anyone know why?

lament mesa
maiden fable
slate swan
#

yeah

#

or remove the third line

#

It says that now.

#

I don't even have a Client() so prolly remove that

#

I reinstalled the command module

#

So idk 🤷

warped mirage
#

Because there’s no point asking all the time

slate swan
#
import discord
from discord.ext import commands
from discord.ext import tasks

bot = commands.Bot(command_prefix = "/")
bot = commands.Bot(command_prefix="!")

@bot.command()
async def ping(ctx):
    await ctx.channel.send("pong")

@slate swan try that?

#

Alright

wide tartan
slate swan
#

and make sure when you run it's like bot.run("token")

wide tartan
#

the import task doesn't exist within d.py

slate swan
slate swan
wide tartan
#

Can you elaborate on what you mean?

slate swan
#

when I press the reaction, it will re-run the command (give another topic)

#

Still not working @wide tartan

wide tartan
#

Use wait_for

magic pond
#

how ?

wide tartan
slate swan
#

Idk tbh im new at this Discord bot programming

#

When I try !ping in my server no reply.

wide tartan
slate swan
#

I add everything back in my token and bot.run("token")

wide tartan
slate swan
#

I can't show the token in here

#

Server dosent let me.

wide tartan
#

Dont put the token here

#

Just show the code without the token

slate swan
slate swan
#
import discord
from discord.ext import commands
from discord.ext import tasks
#TOKEN would be here
bot = commands.Bot(command_prefix = "/")
bot = commands.Bot(command_prefix="!")

@bot.command()
async def ping(ctx):
    await ctx.channel.send("pong")
    bot.run("TOKEN")
#

Idk what the issue is tbh

wide tartan
slate swan
#

Alr

wide tartan
#

Why do you have 2 bot variables

slate swan
#

Idk I followed some guy on disc who was helping me

#

I undentited it that's my output

slate swan
wide tartan
slate swan
#

Damn it shouldn't be

#

Ill reset it

slate swan
wide tartan
#

That event basically detects reactions

slate swan
wide tartan
slate swan
#

I just reseted it @slate swan and it says the same thing

slate swan
#

Same thing different token.

#

and does your bot have permission to send messages?

wide tartan
slate swan
#

It's got admin

#

100% sure

slate swan
wide tartan
#

And yes, please dont have 2 bot variables

slate swan
#
import discord
from discord.ext import commands
from discord.ext import tasks

bot = commands.Bot(command_prefix = "/")
bot = commands.Bot(command_prefix="!")
@bot.command()
async def ping(ctx):
    await ctx.channel.send("pong")
bot.run("token")
#

Bruh

#

Hold on

slate swan
worn folio
#

Hey everyone, anyone used guild.fecth_members? i am trying to capture daily new member joined and total members the server where i am a moderator. i want to store the stats in the db to use it in the dashboard later. thank you!

wide tartan
slate swan
#
import discord
from discord.ext import commands
from discord.ext import tasks

bot = commands.Bot(command_prefix="!")
@bot.command()
async def ping(ctx):
    await ctx.channel.send("pong")
bot.run("token")
#

Same error

#

On the bot.run ? @wide tartan

#

@slate swan I know py 100% I'm new to the discord shit

#

Tf

wide tartan
slate swan
#

It's legit 7am and I haven't slept for 12+ hours 🥴 my brain is far gone tbh

#

doesnt seem healthy does itpithink

slate swan
slate swan
warped mirage
#

Who wanna help me make all my aiosqlite connections into one 😉

slate swan
#

But it's been reset its not invalid.

maiden fable
slate swan
#

Nope

#

One period and a -

maiden fable
#

Then the token is wrong

#

It should contain 2 periods

#

Not 3, not 1

slate swan
#

@maiden fable fixed the token but no input

#

I also tried on my server too.

maiden fable
#

Did u invoke the command?

slate swan
#

do you have the message intent on?

wide tartan
# slate swan

I would suggest setting an on_ready event printing that it's on so you don't get confused if the bot is actually up or not

shrewd apex
shrewd apex
wide tartan
slate swan
#

@wide tartan has he figured it out yet?

#

I'm new 😭😭 im trying my hardest rn so hold on

#

Lemme make sure it's online.

slate swan
#

What's the code to make sure it's ready?

#

Bc i can't find it.

#

I also haven't slept for 12+ hours 😭

slate swan
#

Alright

slate swan
wide tartan
#

Ah, makes sense

slate swan
#
@bot.event
async def on_ready():
    print("I'm online!")

Here's an example on_ready event. @slate swan

warped mirage
#

Hello Asher

warped mirage
#

I’m on 2.0

kindred kernel
#

dpy version doesn't change the basics of python and OOP

slate swan
#

Bots not defined.

#

I hate this 😭😭

#

@wide tartan how can I edit an embed?

slate swan
kindred kernel
slate swan
#
import discord
from discord.ext import commands
from discord.ext import tasks

@bot.event
async def on_ready():
    print("I'm online!")
slate swan
slate swan
slate swan
wide tartan
slate swan
#

No.

wide tartan
#

.

slate swan
wide tartan
#

well, that explains why lol

slate swan
#

Send me what it should look like?

slate swan
#

!resources :))

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

wide tartan
slate swan
#

🔄

wide tartan
#

Also

#

@slate swan are you setting a task loop?

kindred kernel
#

@slate swan See:
The basic of python:
If you are using a variable to do something (you do: @bot.event), you should define it before using it.
SO, you have to define what is bot.
e.g.:

input
print(dead)

output
Error```
```py
input
dead = "me"
print(dead)

output
me```
slate swan
#

Ik how variables work dw

kindred kernel
#

Looked like you dont

wide tartan
#

If you're not setting a task loop, then tasks is not needed

kindred kernel
#

uh, probably yea

slate swan
#

more like methods

#

Legit new asf it would help if you would just send the code 😭

kindred kernel
#

but if he knows python he should've noted that, cus in classes there are familiar @ like @property and else...

slate swan
#

i love python decorators ngl

kindred kernel
slate swan
#

@wide tartan wait_for("reaction_add") only detected if the reaction was pressed one time

kindred kernel
#

maybe

slate swan
#

with (...)

#

Helpful

wide tartan
slate swan
#

its literally just ellipsis bro

#

I haven't slept at all for 12 hours which makes it even funner

kindred kernel
slate swan
#

doesnt matter how much you slept you cant learn a whole programming language in a day :))

#

good things take time!

#

idk how it goes!

#

I just want this to work then I'll sleep like a baby.

valid panther
#

hi

kindred kernel
valid panther
slate swan
#

I legit just want to make a command that's it 😭 there was a error which I fixed and now turned into a huge problem 🙃

slate swan
valid panther
#
  help Shows this message

Type ?help command for more info on a command.
You can also type ?help category for more info on a category.```
#

when i run ?help i get this message

slate swan
#

All i want is the exact code that reply when entering !ping that's it.

kindred kernel
valid panther
paper sluice
slate swan
#

just use the kwarg in the bot constructor

valid panther
slate swan
#

you could also do help_command=None in the bot constructor like @slate swan said

kindred kernel
#

*put it right after defining a bot to have no problem

paper sluice
#

just subclass the default help command...

kindred kernel
slate swan
#

Istfg man 😭

#

The token is invalid again apparently

kindred kernel
#

it's more like they even dont know how to subclass

paper sluice
slate swan
slate swan
slate swan
#

Bot.run 💀

slate swan
kindred kernel
#

without quotes

paper sluice
slate swan
#

JESUS CHRIST

#

2 tired for this shit

wide tartan
slate swan
slate swan
#

Same error when I fixed it.

#

😭😭😭

slate swan
#

I wanna kms man istg

#

don't do that

#
from discord.ext import commands
import discord
token = ("TOKEN HERE")
bot = commands.Bot(command_prefix='$', intents=discord.Intents.all())

@bot.event
async def on_ready():
    print("online")
bot.run("token")
kindred kernel
#

:kms:

slate swan
#

😂

kindred kernel
#

ah, nitro is gone yeah

shrewd apex
kindred kernel
#

but who reads them tbh

shrewd apex
#

lmao true

slate swan
kindred kernel
#

xD

paper sluice
#

honestly subclassing is soo much easier, edit things make super calls and ur done

slate swan
#

Some discord shit now

cloud dawn
slate swan
slate swan
kindred kernel
#

except those who help

slate swan
#

Where's that**

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
shrewd apex
kindred kernel
#

ofcourse i dont remember the link\

slate swan
paper sluice
kindred kernel
shrewd apex
slate swan
#

How do I edit my bot's description using its token?

#

It now says online but when i try !ping dosent respond @slate swan

cloud dawn
slate swan
#

Shouldn't be.

slate swan
#

C:\Users\suraj\Music\Discord-Bot-1.3 (1)\Discord-Bot-1.3>python bot.py
File "C:\Users\suraj\Music\Discord-Bot-1.3 (1)\Discord-Bot-1.3\bot.py", line 35
help_command=None
TabError: inconsistent use of tabs and spaces in indentation

C:\Users\suraj\Music\Discord-Bot-1.3 (1)\Discord-Bot-1.3>python bot.py
File "C:\Users\suraj\Music\Discord-Bot-1.3 (1)\Discord-Bot-1.3\bot.py", line 35
help_command=None
^
IndentationError: unindent does not match any outer indentation level

C:\Users\suraj\Music\Discord-Bot-1.3 (1)\Discord-Bot-1.3>python bot.py
File "C:\Users\suraj\Music\Discord-Bot-1.3 (1)\Discord-Bot-1.3\bot.py", line 45
help_command=None
TabError: inconsistent use of tabs and spaces in indentation

kindred kernel
slate swan
#

your prefix is $ not a !. try doing $ping @slate swan

#
from discord.ext import commands
import discord
token ("TOKEN HERE")
bot = commands.Bot(command_prefix='$', intents=discord.Intents.all())

@bot.event
async def on_ready():
    print("bot online!")
bot.run(token)
slate swan
cloud dawn
kindred kernel
#

and also try reading tracebacks

paper sluice
#

or any ide ur using

#

it should have something similar

warped mirage
#

OMG let’s go

slate swan
#

ryuga how do I check for every reaction press?

warped mirage
#

Many helpers online lol

slate swan
slate swan
cloud dawn
slate swan
#

No error but no response when I try $ping

slate swan
slate swan
slate swan
warped mirage
slate swan
#
from discord.ext import commands
import discord
token = ("Token")
bot = commands.Bot(command_prefix='!', intents=discord.Intents.all())

@bot.event
async def on_ready():
    print("bot online!")
bot.run(token)
paper sluice
warped mirage
#

Ashley can u help me fix lol

kindred kernel
warped mirage
slate swan
slate swan
valid panther
#

bot.help_command = HelpCommand()
NameError: name 'HelpCommand' is not defined
@paper sluice its giving meh this error

slate swan
kindred kernel
#
@bot.command()
async def ping(ctx):
    await ctx.send('PONG!')``` @slate swan
warped mirage
#

Lmao 🤣

slate swan
slate swan
paper sluice
cloud dawn
slate swan
cloud dawn
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), This class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.
warped mirage
#

Maybe something wrong with my None statements

#

Idk ima check

kindred kernel
paper sluice
slate swan
paper sluice
#

version?

cloud dawn
kindred kernel
warped mirage
kindred kernel
#

maybe you put it in wrong place

warped mirage
#
@commands.command()
    async def set_msg(self, ctx):
        async with aiosqlite.connect("wm.db") as db:
            cursor = await db.cursor()
            await cursor.execute("SELECT welcome  FROM wm where guild_id = ?", (ctx.guild.id,))
            data = await cursor.fetchone()

            if not data:
             await cursor.execute("INSERT INTO wm(guild_id, channel_id, welcome) VALUES(?,?,?)", (ctx.guild.id, ctx.channel.id, 'xyz',))
             await db.commit()
             return await ctx.send(f"Welcome message has been set!")
            
            await cursor.execute("SELECT welcome  FROM wm WHERE guild_id = ?", (ctx.guild.id,))
            mesg = await cursor.fetchone()
            if not mesg: return await ctx.send("There is no welcome message currently set.", delete_after = 10)
            return await ctx.send(f"welcome message is {mesg}")```
cloud dawn
kindred kernel
#

mesg[0]

slate swan
# kindred kernel show code
import discord
token = ("Token here")
bot = commands.Bot(command_prefix='!', intents=discord.Intents.all())

@bot.event
async def on_ready():
    print("bot online!")
bot.run(token)

@bot.command()
async def ping(ctx):
    await ctx.send('PONG!')
warped mirage
valid panther
#

i am getting this error now

slate swan
cloud dawn
#

Lol tbf Ryuga did say that.

slate swan
#

poor ryuga

kindred kernel
cloud dawn
unkempt canyonBOT
#

class discord.ext.commands.HelpCommand(*args, **kwargs)```
The base implementation for help command formatting.

Note

Internally instances of this class are deep copied every time the command itself is invoked to prevent a race condition mentioned in [GH-2123](https://github.com/Rapptz/discord.py/issues/2123).

This means that relying on the state of this class to be the same between command invocations would not work as expected.
slate swan
kindred kernel
shrewd apex
#
class classname(commands.HelpCommand)
warped mirage
#
@commands.command()
    async def set_msg(self, ctx):
        async with aiosqlite.connect("wm.db") as db:
            cursor = await db.cursor()
            await cursor.execute("SELECT welcome  FROM wm where guild_id = ?", (ctx.guild.id,))
            data = await cursor.fetchone()

            if not data:
             await cursor.execute("INSERT INTO wm(guild_id, channel_id, welcome) VALUES(?,?,?)", (ctx.guild.id, ctx.channel.id, 'xyz',))
             await db.commit()
             return await ctx.send(f"Welcome message has been set!")
            
            await cursor.execute("SELECT welcome  FROM wm WHERE guild_id = ?", (ctx.guild.id,))
            mesg[0]
            mesg = await cursor.fetchone()
            if not mesg: return await ctx.send("There is no welcome message currently set.", delete_after = 10)
            return await ctx.send(f"welcome message is {mesg}")``` is this better
slate swan
cloud dawn
kindred kernel
#

More like

slate swan
paper sluice
# slate swan version 2.0
from discord.ext import menus

class MyMenu(menus.Menu):
    async def send_initial_message(self, ctx, channel):
        return await channel.send(f'Hello {ctx.author}')

    @menus.button('\N{THUMBS UP SIGN}')
    async def on_thumbs_up(self, payload):
        await self.message.edit(content=f'Thanks {self.ctx.author}!')

    @menus.button('\N{THUMBS DOWN SIGN}')
    async def on_thumbs_down(self, payload):
        await self.message.edit(content=f"That's not nice {self.ctx.author}...")

    @menus.button('\N{BLACK SQUARE FOR STOP}\ufe0f')
    async def on_stop(self, payload):
        self.stop()

# later
@bot.command()
async def menu_example(ctx):
    m = MyMenu()
    await m.start(ctx)

try out menus then

kindred kernel
#

'tralala {mesg[0]}'

shrewd apex
cloud dawn
slate swan
#
from discord.ext import commands
import discord

bot = commands.Bot(command_prefix='!', intents=discord.Intents.all())
@bot.event
async def on_ready():
    print("bot online!")
bot.run(token)
@bot.command()
async def ping(ctx):
    await ctx.send('PONG!')
paper sluice
# slate swan wtf is this

its just reactions + callbacks. callback is the function that will be called everytime someone interacts with the emoji/reaction

shrewd apex
#

discord has a built-in paginator as well

kindred kernel
slate swan
#
from discord.ext import commands
import discord

bot = commands.Bot(command_prefix='!', intents=discord.Intents.all())
@bot.event
async def on_ready():
    print("bot online!")

@bot.command()
async def ping(ctx):
    await ctx.send('PONG!')

bot.run(token)

@slate swan

warped mirage
slate swan
paper sluice
paper sluice
slate swan
#

Nope @slate swan

cloud dawn
slate swan
kindred kernel
slate swan
#

No response

#

@slate swan lemme inv u to my server

warped mirage
#

Xd

kindred kernel
warped mirage
#

Hey Pandabweer

cloud dawn
cloud dawn
warped mirage
#

Wanna help now I guess lol , I managed to get my bot work a bit more

paper sluice
cloud dawn
paper sluice
#

they update lib, whole code base gone

slate swan
#

@paper sluice how would I do it without menus?

paper sluice
slate swan
warped mirage
paper sluice
cloud dawn
slate swan
warped mirage
#

....

cloud dawn
warped mirage
#

hmm

#

well can u help me . i just need 4 basic commands then

slate swan
cloud dawn
warped mirage
#

I never subclass tbf I wouldn’t be here if I wouldn’t need help , u know what I mean?

#

I don’t know how I guess

cloud dawn
#

Okay well then let's subclass it since then programming is a lot easier

warped mirage
#

Will my welcome system work tho

#

For multiguilds

brazen raft
#

And you can use it like commands.Bot

class MyBot(commands.Bot):
    pass
brazen raft
#

In the __init__ method you can define a connection attribute to use everywhere

warped mirage
#

And I already have commands.bot in my main file

brazen raft
cloud dawn
warped mirage
#

Oh damn so means I gotta restart

#

Ye idk I need help re building my system if I’m gonna restart

cloud dawn
#

Could you show your main file?

warped mirage
cloud dawn
#

I could also use example code.

slate swan
warped mirage
#

I don’t even know at this point what to do

#

I just want a simple welcome system for multi guilds

brazen raft
brazen raft
#

What

slate swan
#

not in on_ready

brazen raft
#

Yeah true

#

Then where

placid skiff
cloud dawn
slate swan
brazen raft
#

Teach me

heavy shard
#

hmmmm
if if wanted async intialisation and finalisation in cog, would setup() and teardown() be fine?
i see no other async methods for that...

slate swan
# brazen raft Teach me
from discord.ext import commands
import aiosqlite

class MyBot(commands.Bot):
  db: aiosqlite.Connection
  def __init__(self):
    super().__init__(...)
  
  async def setup_hook(self):
    self.db = await aiosqlite.connect("_.db")

thats how

brazen raft
#

Cool thanks, will definitely use it.

heavy shard
#

or maybe __init__ and unload_cog and bot.loop.create_task ?

slate swan
brazen raft
#

The type hinting, I mean

slate swan
brazen raft
#

Really? Because there's self

slate swan
#

uhhh yes fixed

brazen raft
#

Well now it's a class variable, not an instance attribute

slate swan
#

its just a typehint...

brazen raft
#

Just put it in the __init__

slate swan
#

as you wish

brazen raft
slate swan
#

you can still pretty much typehint it

#

who pinged me?

kindred kernel
#

i did

slate swan
#

sweet

slate swan
#

@slate swan do yk how I can detect every reaction press?

slate swan
#

mb

kindred kernel
#

!d discord.on_raw_reaction_add

unkempt canyonBOT
#

discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_reaction_add "discord.on_reaction_add"), this is called regardless of the state of the internal message cache.

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

await client.wait_for("raw_reaction_add")?

#

no it should be an async function

kindred kernel
slate swan
slate swan
slate swan
slate swan
slate swan
slate swan
cloud dawn
# warped mirage Ok , then lets start
from __future__ import annotations
import asyncio

from discord import Intents
from discord.ext.commands import Bot

import aiosqlite

class Example(Bot):
    db: aiosqlite.Connection

    def __init__(self, **kwargs) -> None:
        super().__init__(**kwargs)

    async def run(token: str, **kwargs) -> Example:
        await super().start(token, **kwargs)

    async def setup_hook(self) -> None:
        self.db = await aiosqlite.connect("_.db")

    async def on_ready(self) -> None:
        print("Ready")

bot = Example(command_prefix="!", intents=Intents.all())
asyncio.run(bot.run(TOKEN, reconnect=True))
slate swan
warped mirage
cloud dawn
brazen raft
warped mirage
#

Oh my idk what to do anymore

#

So now I must rewrite the bot once again

slate swan
shrewd apex
cloud dawn
slate swan
cloud dawn
warped mirage
#

Like what am I meant to have ?!?!

shrewd apex
#

yeah they are all steps to make ur bot not something esoteric

shrewd apex
warped mirage
#

I’ve been stuck on this welcome system for 4 days now lol

slate swan
# slate swan any examples?
@Bot.listen("on_raw_reaction_add")
async def uwu_reaction_listener(payload: discord.RawReactionActionEvent):
  ''' Called when a message has a reaction added. Unlike on_reaction_add(), this is called regardless of the state of the internal message cache. '''

  ''' attributes for payload '''

  ''' 
    - channel_id: the channel ID which got or lost the reaction
    - user_id: The user ID who added the reaction or whose reaction was removed.
    - message_id: The message ID that got or lost a reaction.
    - guild_id: The guild ID where the reaction got added or removed, if applicable.
    - emoji: The custom or unicode emoji being used.
    - member: The member who added the reaction. Only available if event_type is REACTION_ADD and the reaction is inside a guild.
    - event_type: The event type that triggered this action. Can be REACTION_ADD for reaction addition or REACTION_REMOVE for reaction removal.
  '''
cloud dawn
slate swan
#
import asyncio

async def main():
  async with bot:
    await bot.start("token")

asyncio.run(main())```
#

thats how

slate swan
#

well, it is what it is

cloud dawn
#

Okay

placid skiff
#

I will not comment this D_D

warped mirage
#

Lol

kindred kernel
#

why :D_D:

warped mirage
#

Nah I’m finished

tulip matrix
#

!discord_errors

kindred kernel
#

nah

slate swan
warped mirage
#

Damn

tulip matrix
cloud dawn
slate swan
tulip matrix
#

do you want a screenshot of code

slate swan
heavy shard
#

Pandabweer: about opening/connecting database in setup_hook ... doesn't it need db.close() somewhere on shutdown?

warped mirage
#

Anyways back to v 1.7.3 lol

placid skiff
#

Disnake exists D_D

slate swan
warped mirage
heavy shard
#

ah right, thanks

slate swan
placid skiff
cloud dawn
slate swan
heavy shard
#

ok ok

warped mirage
#

And even if I do no one knows how to fix

#

Lol

placid skiff
#

Then you will need to study more because it is simple D_D

warped mirage
#

Whoever thinks databases are easy to learn then idk

placid skiff
#

It's the simplest database D_D

slate swan
warped mirage
placid skiff
#

Try aiogram then D_D

warped mirage
#

I can’t I already went to far on with my bot

#

I can’t just keep stopping each time

placid skiff
#

I was sarcastic .-. aiogram requires more experience than aiosqlite .-.

warped mirage
#

Ok

livid hinge
paper sluice
kindred kernel
#
from disnake import welcomesys

...

welcomesys.use_db(db_type, db_name, db_host, db_pass)
# or you can use welcomesys.use_json(filename)

welcomesys.start(bot)``` @warped mirage hey! disnake added this in last update, try this out
kindred kernel
#

:kyber_mega_ultra_lemao:

brazen raft
heavy shard
#

Ashley, so is there an equivalent of shutdown_hook ?

low latch
#

dont use that kind of language please

warped mirage
low latch
#

yes

warped mirage
#

livid hinge
#

your question is about a multi-guild welcome system

warped mirage
#

6 hours a day 💀

#

24 hours and I still haven’t figured out

cloud dawn
#

Is pontifex new? Never seen this man before in my life.

livid hinge
#

damn

livid hinge
#

just new pfp ig

warped mirage
#

Guys how do u even learn how to make all of this … it’s not like docs always show how to make new commands or like systems

warped mirage
#

Ok

#

I’ll take github has the answer

cloud dawn
#

Brain smaller than -

slate swan
warped mirage
#

U guys do

brazen raft
slate swan
heavy shard
#

would this be fine?

async def main():
    await open_database()
    async with client:
        await client.start(TOKEN)
    await close_database()

asyncio.run(main())
livid hinge
#

github, google, and trial and error

robust fulcrum
#

Guys how can we take input from user in discord.py
Can anyone tell me with a example
(I searched Google but not understood)

cloud dawn
slate swan
#

at least, finally authorized for github co-pilot uwu

placid skiff
warped mirage
slate swan
placid skiff
#

literally months

slate swan
#

okay nice, github co-pilot has crashed...

cloud dawn
#

github copilot is still in beta no?

livid hinge
#

whats the controversy about ways of starting

slate swan
placid skiff
cloud dawn
slate swan
livid hinge
slate swan
cloud dawn
robust fulcrum
#

Guys how can we take input from user in discord.py
Can anyone tell me with a example
(I searched Google but not understood)

livid hinge
#

kite is god-awful

kindred kernel
#

!d discord.ext.commands.Bot.wait_for

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.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
robust fulcrum
livid hinge
#

tabnime reminded me of how bad it was 🤣

kindred kernel
paper sluice
#

i don't use any auto completing software...

robust fulcrum
placid skiff
#

i'm pretty comfortable with copilot tbh

warped mirage
#

Can someone just help me finish my welcome system or atleast the error

cloud dawn
kindred kernel
#

oh yeah ^

warped mirage
#

Guys does it take a long time to learn most of discord.py honest answers

cloud dawn
warped mirage
#

Because I wanna be a good coder uknow and not be so crap at all of and have to ask for help so much

cloud dawn
#

You mean input()?

robust fulcrum
cloud dawn
robust fulcrum
cloud dawn
placid skiff
paper sluice
robust fulcrum
placid skiff
#

I learned it in a week..

robust fulcrum
#

First Learn python......

warped mirage
#

Ok I’ll take ur advice and I’ll see how I do

cloud dawn
robust fulcrum
#

Learn the language before using its library

slate swan
# robust fulcrum Means i asking how to use input in dpy
resp = await client.wait_for("message")
''' if resp gets the response in time, it will return a Message object ''' 

''' timeout '''
import asyncio

try:
  resp = await client.wait_for("message", timeout=seconds)
except asyncio.TimeoutError:
  await ctx.send("no")
finally:
  do_uwu_stuff_if_you_like()

''' check '''
def check(msg):
  return msg.author.id == ctx.author.id and msg.channel.id == ctx.channel.id

resp = await client.wait_for("message", check=check) #this will only return the message which meets the proper requirements

''' combined '''
try:
  resp = await client.wait_for("message", check=check, timeout=69)
except asyncio.TimeoutError:
  return await ctx.send("uwu")

if you want the input to be a message

placid skiff
slate swan
#

why did I write all that

cloud dawn
placid skiff
#

lmao

robust fulcrum
slate swan
robust fulcrum
#

Then for loop?

cloud dawn
robust fulcrum
placid skiff
#

Lol you can't

slate swan
cloud dawn
#

for x in range(10):
while True:

slate swan
#

fuck, github co-pilot is the shittiest software i've seen

robust fulcrum
#

😨

#

Guys anyone here know how can we host our bot for free except replit

dense swallow
#

i have a question, if i have commands.CommandInvokeError as an error handler, do i need Member/Role/ChannelNotFound handlers?

cloud dawn
slate swan
#

*, args

#

😔

robust fulcrum
#

*args?

dense swallow
#


@commands.command(name="example")
async def ex_ample(self, ctx: Context, *, args) -> None:
    await ctx.send(arg)
cloud dawn
slate swan
#

@warped mirage flex 😔

slate swan
robust fulcrum
#

H

warped mirage
cloud dawn
slate swan
warped mirage
#

And unlucky for me

slate swan
warped mirage
#

Bruh now I can’t even make the system

slate swan
#

you could still refer to mine, its not the best, its not the worst

warped mirage
#

Didn’t ask for comments lol

slate swan
#

never made a comment...

warped mirage
cloud dawn
warped mirage
paper sluice
cloud dawn
#

file names starting with a capital letter.

warped mirage
#

Hikari tho

slate swan
warped mirage
#

Oh my days why am I so unlucky

placid skiff
#

Package starts with capital

slate swan
# placid skiff Duh weirds

idk, I have a bad habit of doing that cuz I generally name my react.js files with capital letters, stop humiliating me for no reason 😔

placid skiff
#

Uh i didn't want to sad_coffee_pepe

dense swallow
slate swan
warped mirage
#

Ye thought so

#

If I can use hikari and aiosqlite in my bot then I will do it

cloud dawn
slate swan
#

uhhh

#

dont use hikari

placid skiff
slate swan
#

its complex than dpy

#

^

#

plus reading docs

cloud dawn
warped mirage
#

Rip

slate swan
warped mirage
#

Finished ones again

slate swan
#
@plugin.command
@lightbulb.option(name="query", description="The subject to search for!", type=str, required=True)
@lightbulb.command(name="news", description="...", auto_defer=True, ephemeral=True)
@lightbulb.implements(lightbulb.PrefixCommand)
async def news_command(ctx: lightbulb.SlashContext):
  ...
@Bot.command(name=..., description=...)
async def news_command(ctx: commands.Context, query: str):
  ...

huge difference

#

and the fact that you dont necessarily have to use classes for extensions

cloud dawn
placid skiff
#

Disnake has only one D_D

cloud dawn
slate swan
slate swan
cloud dawn
slate swan
placid skiff
slate swan
cloud dawn
#

dpy just needs to fix small issues. Then it's good

#

Like not needing to pass Intents since you can have no intents and auto sync + better cogs for slash cmds.

slate swan
#

this kills me tbh

cloud dawn
#

This is how I load "cogs" in a Client bot for slash cmd's ```py
import importlib
import inspect
import pkgutil

from typing import Iterator, NoReturn

import exts
from discord.app_commands import Group

def unqualify(name: str) -> str:
"""Return an unqualified name given a qualified module/package name."""
return name.rsplit(".", maxsplit=1)[-1]

def walk_extensions() -> Iterator[str]:
"""Yield extension objects from the exts subpackage."""

def on_error(err_name: str) -> NoReturn:
    raise ImportError(name=err_name)  # pragma: no cover

for module in pkgutil.walk_packages(exts.__path__, f"{exts.__name__}.", onerror=on_error):
    if unqualify(module.name).startswith("_"):
        # Ignore module/package names starting with an underscore.
        continue

    if module.ispkg:
        imported = importlib.import_module(module.name)
        for name, obj in inspect.getmembers(imported):
            if inspect.isclass(obj) and issubclass(obj, Group):
                yield obj

EXTENSIONS = frozenset(walk_extensions())

warped mirage
#

Can someone help me with my error

cloud dawn
slate swan
warped mirage
cloud dawn
warped mirage
#

Ok nevermind

#

Let’s just forget I asked

slate swan
#

preferably*

cloud dawn
#

Some widget stuff too

slate swan
cloud dawn
# slate swan wha-
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.bumptech.glide.Glide;
import com.google.gson.Gson;
slate swan
#

jeez

cloud dawn
#

I'm making an android app 😂

slate swan
cloud dawn
#

Isn't flutter the wordpress android version?

cloud dawn
#
StringRequest earthquakeRequestInduced = new StringRequest(Request.Method.GET,
        "https://cdn.knmi.nl/knmi/map/page/seismologie/all_induced.json",
        resp -> {
            induced = gson.fromJson(resp, EarthquackeDataNetherlands.class);
            for (Event item: induced.events) {
                if (item.place.equals(parsed_data.name)) {
                    Log.w(TAG, "Found quacke");
                }
            }
        }, error -> Log.w(TAG, "Error while getting NL induced earthquakes" + error));
``` besides who doesn't want this.
#

If you look at it correctly you can see that this is a single class definition.

warped mirage
#

Lol

cloud dawn
slate swan
slate swan
#

sheesh

cloud dawn
#

:3

stiff gorge
#
    @commands.command(aliases=['bal'])
    async def balance(self,ctx):
        await open_account(ctx.author)
        user = ctx.author
        users = await get_bank_data()
        wallet_amt = users[str(user.id)]["wallet"]
        bank_amt = users[str(user.id)]["bank"]
        em = discord.Embed(title=f'{ctx.author.name} Balance',
                           color=discord.Color.red())
        em.add_field(name="Wallet", value=wallet_amt)
        em.add_field(name='Bank', value=bank_amt)
        await ctx.send(embed=em)

if a users id is not there in mainbank.json how to i make the bot send this message you need to start

robust fulcrum
#

from matplotlib import pyplot as plt
import numpy as np

nov = int(input("enter number of values"))
initial = 1
cars = []
while initial<=nov:
	print("enter the value to append")
	apen = input()
	cars.append(apen)
	initial = int(initial+1)

nop = int(input("enter number of values for pie chart"))
initials = 1
data = []
while initials<=nop:
	print("enter the value of pie chart to append")
	apens = int(input())
	data.append(apens)
	initials = int(initials+1)

fig = plt.figure(figsize =(10, 7))

plt.pie(data, labels = cars)
 
plt.savefig("chart.png")

Can anyone help me covert this into discord command?

cloud dawn
# stiff gorge ```py @commands.command(aliases=['bal']) async def balance(self,ctx): ...
    @commands.command(aliases=['bal'])
    async def balance(self,ctx):
        await open_account(ctx.author)
        user = ctx.author
        users = await get_bank_data()
        if not str(user.id) in users:
            return await ctx.send("Not found")
        wallet_amt = users[str(user.id)]["wallet"]
        bank_amt = users[str(user.id)]["bank"]
        em = discord.Embed(title=f'{ctx.author.name} Balance',
                           color=discord.Color.red())
        em.add_field(name="Wallet", value=wallet_amt)
        em.add_field(name='Bank', value=bank_amt)
        await ctx.send(embed=em)
unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

maiden fable
#

I mean, he wants help converting it into a command?

slate swan
placid skiff
west wigeon
#

and take input from the command arguments, not from the console

#

this is a bit trickier, though, since you have a varying number of values ...

#

can still be done, though. a command that takes multiline input.

#

or maybe just two arguments, each of which is a comma-delimited list, then convert those to lists before passing to pyplot

light violet
#

await ctx.command.invoke(ctx)
File "/home/runner/Alpha/venv/lib/python3.8/site-packages/disnake/ext/commands/core.py", line 914, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/Alpha/venv/lib/python3.8/site-packages/disnake/ext/commands/core.py", line 181, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'User' object has no attribute 'add_role'
getting this error pls help me

gg = await ctx.guild.create_role(name = "Alpha.Beta",colour =0x206694 )
      
      await gg.edit(position = ctx.guild.me.top_role.position-1)
      await ctx.send("Done......")
      await c.add_role(gg)```
#

c = client.get_user(980705483566493706)

slow fog
slate swan
slow fog
#

What are you doing right now

slate swan
#

its 10 am already

placid skiff
#

Lol you sleep in the morning?

slow fog
slow fog
#

Its 12 pm for me currently

slate swan
#

two nights specifically

vale wing
shrewd apex
#

i have a color in hex value in string '#ffffff' how do i get color from this in embed

velvet haven
#

How to host discord bot for free 24x7

placid skiff
maiden fable
shrewd apex
#

ok lemme try

maiden fable
#

I use 0x codes

placid skiff
#

Maybe with the row value?

shrewd apex
#

'0xfffff' like inside a string?

#

got it working now

#

thx setattr

maiden fable
shrewd apex
#

lmao well then thx hunter

robust fulcrum
#

Guys will bot.wait_got work in cogs?

shrewd apex
#

where is the check it will give check not defined

robust fulcrum
#

Oh

robust fulcrum
shrewd apex
#

u have to make a check

robust fulcrum
#

Already done

#

It's at top

#

It's showing me indentation error even it's correct

loud junco
shrewd apex
loud junco
shrewd apex
#

u could just put all cogs in a folder then load it at once

loud junco
#

i cant await it

robust fulcrum
#

Hey I ahve a easy way

shrewd apex
#

commando. is a part of your file name?

loud junco
robust fulcrum
#

cogs = ["cogs.invite","cogs.quote","cogs.wanted","cogs.purge","cogs.pot","cogs.image","cogs.spotify","cogs.channel","cogs.anime"]

@bot.event
async def on_ready():
	print("The bot is ready!")                
	print("Loading cogs . . .")               
	for cog in cogs:                          
		try:                                  
			await bot.load_extension(cog)           
			print(cog + " was loaded.")       
		except Exception as e:               
			print(e)

I use this way you can try it

loud junco
#

on_ready 💀

#

ashley told me not to do this

shrewd apex
#

do this ur files as i see is in a relative path so u need commando/xyz

shrewd apex
robust fulcrum
#

@shrewd apex can you help me
I am getting indentation error even it's correct

shrewd apex
#

ur cogs load after bot loads

loud junco
shrewd apex
loud junco
#

i awaited them

shrewd apex
#

dont load with command either

loud junco
#

then how

#

i cant load it outside function

#

cuz i cant await them outside

robust fulcrum
shrewd apex
#

do

async main():
   async with bot:
      await bot.load_extension('xyz')
      await bot.start(token)
asyncio.run(main())
loud junco
#

ok

shrewd apex
#

in the end u can just copy paste

loud junco
#

ok

robust fulcrum
shrewd apex
#

ur load extensions in the async with bot part

loud junco
#

i change token to os.getenv blahblah?

shrewd apex
shrewd apex
loud junco
#

and i remove the last line?

shrewd apex
#

yeah

#

now initialise your bot using bot.start

#

run may get depreceated

robust fulcrum
shrewd apex
#

u cant mix tabs and spaces when indenting

robust fulcrum
#

Hmm

shrewd apex
#

read the error before asking first

robust fulcrum
#

Me on mobile no tab :(

loud junco
#

how on earth are they not awaited

#

@shrewd apex help ;-;

shrewd apex
#

hmm lemme see mine

loud junco
#

ok

#
import asyncio

async def main():
  async with bot:
    await bot.load_extension(...)
    await bot.start("token") #use this function instead of "bot.run()"

asyncio.run(main())
```?
shrewd apex
#

thats strange

robust fulcrum
#

@shrewd apex i did all indents correct still it shows

shrewd apex
#

are all the cog names correct?

robust fulcrum
#

My?

shrewd apex
#

no

loud junco
shrewd apex
loud junco
#
from discord.ext import commands
import discord
from progress.stats import *

class Area(commands.Cog):
  def __init__(self, bot):
    self.bot = bot

  @commands.command()
  @commands.cooldown(1, 1, commands.BucketType.user)
  async def area(self, ctx, arg: int):
    try:
      stats = Stats(ctx)
      if 1 <= arg <= 14:
        if arg <= stats.highestArea:
          db[stats.userid + 'area'] = arg
          await ctx.send(f'**{ctx.author.name}** has moved to **AREA {arg}**')
        else:
          await ctx.send(f'**{ctx.author.name}** fight more bosses to unlock this area :D')
      else:
        await ctx.send('404 area not found')
    except KeyError: #error handler
      await ctx.send(f'**{ctx.author.name}**, your account is either not created yet or not at the latest version. Try using `rpm start`')
      
def setup(bot):
    bot.add_cog(Area(bot))
```this is one of my cogs
#

is it correct?

shrewd apex
#
async def load():
  for filename in os.listdir("./commando"):
      if filename.endswith(".py"):
          await client.load_extension(f'commando.{filename[:-3]}')
async def main():
  async with bot:
    await load()
    await bot.start("token") #use this function instead of "bot.run()"

asyncio.run(main())
loud junco
#

huh ok

shrewd apex
#

do this and load your cogs

loud junco
#
async def load():
  for filename in os.listdir("./commando"):
      if filename.endswith(".py"):
          await client.load_extension(f'commando.{filename[:-3]}')
```copy pasta this?
#

@shrewd apex

shrewd apex
#

yeah

robust fulcrum
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.