Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instructions about required "setup" function on cog extensions #9

Closed
EmoonX opened this issue Feb 15, 2021 · 1 comment
Closed

Comments

@EmoonX
Copy link

EmoonX commented Feb 15, 2021

As I was getting myself acquainted with cogwatch (and Cogs themselves), unfortunately, I lost quite some time dealing with extension-related errors upon trying to reload a cog file; until finding out I needed to add the following function at the bottom of it:

def setup(bot: commands.Bot):
    '''Add cog every time extension (module) is (re)loaded.'''
    bot.add_cog(MyCog(bot))

However, there is no explicit reference to the Extension concept in cogwatch tutorial, even though discord.py extensions page mentions hot-reloading. Since it seems to be a lower-level concept that many users that arrive here aren't aware of (myself included), I think it might be interesting to add tutorial instructions regarding these points (especially the needed setup function). 🙂

robertwayne pushed a commit that referenced this issue Feb 15, 2021
robertwayne pushed a commit that referenced this issue Feb 15, 2021
* Add example command / cog file. (#9)

* Added poetry script for running the subclassed bot.

* Added example runner script for testing.

* Fixed bug after moving logging out to init file.
@robertwayne
Copy link
Owner

Thanks for the feedback!

I've added a complete example to the examples directory that should help guide developers unfamiliar with the cog concept in the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants