5

A Cogs Example for the rewrite version of - discord.py

 2 years ago
source link: https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Instantly share code, notes, and snippets.

A Cogs Example for the rewrite version of - discord.py

Nice.

@mixa611

Are you not running the rewrite version of discord.py?

linkzyzvg commented on Jan 21, 2018

edited

Thanks to ZeLarpMaster from discord for telling me that you gotta put the cogs in a folder named cogs because without his guidance idk what i was doing

modelmat commented on Jan 21, 2018

edited

Mysterial, if you want to, add this somewhere: https://gist.github.com/Modelmat/ff2dc0953bf0f399fdd2083b74b4755d
A few other changes like the file names are in there too that are relevant to clearing up.

I made a revision to my fork because "client.change_presence" parameter was changed from "game" to "activity"

I created another gist to make this example compatible with the current rewrite version (where cogs derive from commands.Cog) -- https://gist.github.com/OneEyedKnight/f0411f9a5e9dea23b96be0bf6dd86d2d

Ok, now that's epic

very helpful +1

thank u sir

Honestly Idk why so many people use Python rather than JS to make bots. This cogs example is wonderful

thank god this exists

You can make cog_check instead of @commands.is_owner decorator before owner cog commands.

do NOT change the bots status on the "on_ready" event!!

"Don't change_presence in on_ready within your Bot or Client.
Discord has a high chance to completely disconnect you during the READY or GUILD_CREATE events (1006 close code) and there is nothing you can do to prevent it.

Instead set the activity and status kwargs in the constructor of these Classes.

Basically: don't do shit in on_ready"

Will use this a reference for migrating my bot to cog. thank you very much

QuarkField commented on May 24, 2021

edited

tysm super helpful ngl but I thought you're not supposed to change status and stuff in on_ready(): ?

bot_example.py is bad on so many levels...

bot_example.py is bad on so many levels...

Explaining why it's bad would be a good idea... Right?
@tooruu

bot_example.py is bad on so many levels...

Explaining why it's bad would be a good idea... Right?
@tooruu

Yeah i don't really know either, except the change presence mentioned earlier in the comments.
Any good advice you got?

Extremely useful. Thank you for putting this together. I wasn't finding much info on Discord command handlers and Cogs. Super informative.

Discord.py 2.0.0 How?

is there an updated version for 2.0.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK