-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: dev command for managing extensions #34
Conversation
We probably want a better check for this, but I'm just adding this now in case it reaches production
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for implementing these! I have left a few comments, but I also wanted to ask: are these commands ever to be used in production? Or is this just for development convenience?
Required permission is `manage_guild` as per ib-ai#34 (comment) (highest perm that SysAdmins have)
I'm adding this mainly for development convenience but I could see this being used in production too (e.g. if a vulnerability is found in a specific cog then the rest of the bot can run as normal while it gets patched) |
7380f23
to
cf09663
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! Should only be a couple quick changes - please see my PR comments.
Changes made: - Strip extension names before processing - Use existing `utils.commands.available_subcommands` instead of `ctx.send_help` for consistency (this may be changed back later in ib-ai#36) - Typehints for `ctx` - Docstring formatting consistency - Logging of load/unload/reloading of extensions
89a1385
to
89c4f7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
# Conflicts: # cogs/dev.py
This allows for hot-reloading cogs in extensions (i.e. changes can be reloaded without having to restart the whole bot).
Usage:
<prefix>ext list
: shows a list of loaded extensions<prefix>ext load <ext_name>
: loads a new extension (not loaded yet)<prefix>ext unload <ext_name>
: unloads a loaded extension<prefix>ext reload <ext_name>
: reloads an already loaded extensionExtensions are assumed to be in
cogs/
.<ext_name>
can be just the name of the extension (e.g.dev
) or the full path (e.g.cogs.dev
).Note that changes in app commands may have to be synced separately (
sync *
) after (re-)loading an extension.