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
Application Command Manager #5992
Conversation
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.
This is working great, just gonna wait for a sanity check from TrustyJAID! 👍
I think a good middle ground for this is to provide a tag that would label a command as "essential" and if the essential command is disabled/not there then it fails to load completely. Or it can be flipped so that there's a tag that marks it as "optional". |
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.
Just a quick glance on things from an API hygiene POV.
From a different POV, I'm not really sure how I feel about the partial loads like I've mentioned before long ago. I get the limits are a thing and there needs to be some sort of solution to the problem. One of the ones I've thought about involve tagging the commands as optional or not and when installing a cog the user can pick which optional components they want to add or have it fail if the slash commands themselves can't fit within the limit. It's a middle ground that allows extension developers to pick what functionality they expect to be there without it being taken from them should they do something with it at runtime.
Anyway these are just random musings. I didn't spend much time on this review, only like 5 minutes or so.
else: | ||
log.exception(type(error).__name__, exc_info=error) | ||
|
||
def _remove_with_module(self, name: str, *args, **kwargs) -> None: |
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.
Note this method is private so it'll probably break in the future.
After reading through the comments here I think there are some minor things we can address before this gets merged. @Zephyrkul makes a good point about the promise of partial loading. I still believe this is the best path forward for a modular Red the way this PR currently is but there could be cases where a cog creator may make strictly slash command only cogs and it would be inconvenient to have the cog fail to function because we intervened when attempting to add it. Perhaps it would be best to add a new |
Info.json would work fine for published cogs, perhaps instead we can provide a decorator that tags a command as necessary at the code level that way this would work for both published and unpublished cogs |
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.
Most things seem fine. I would like to see Danny's review addressed as well as a few things here I mentioned.
Another question here, should the slash control commands also be special cased like the licenseinfo commands to allow them to be run via mention? While I know red doesn't officially supports slash only/public bots this could be a convenient way to allow slash-only/public bots based on red to sync their commands without the message content intent. |
I know Zeph was pointing out that the current In terms of adding a way to make a command required-enabled in order to load a cog, I would not be comfortable adding that to I have no opinion on special casing All other comments up to this point should be addressed at this point. |
Theoretically it doesn't hurt making it an always available command, but at the same time. We're talking about a owner only command which is just fine being run in DMs, I expect a bot owner to know their own prefix and not rely solely on slash commands. So for me its a pass on making it always available. |
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.
This looks good to me!
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.
Gonna go ahead and merge this. Since all the outstanding issues have been resolved.
Description of the changes
Closes #5672
Checklist for this PR
[p]slash enable <command> [type]
- Enables a specific app command.[p]slash disable <command> [type]
- Disables a specific app command.[p]slash enablecog <cog>
- Enables all app commands from a cog.[p]slash disablecog <cog>
- Disables all app commands from a cog.[p]slash list
- Lists all app commands the bot can see, and whether they are enabled.[p]slash sync
- Syncs app commands to discord.RedTree
.Future work
app_commands
with Red objects, similar to existing overrides forext.commands
.app_commands.errors.BotMissingPermissions
permissions
to work with slash commands/hybrid commands. Since slash commands can be restricted with built in discord permissions, I don't think it's a major concern to getpermissions
working with them. Still, it might be something we want to do in the future.AppCommand
objects (Add functionality to mention app commands #5976)id
attribute filled from the config values stored in this PR to theCommand
subclass.@app_commands.command()
deco which causes the command to bypass normal load logic.PartialMessageable
limitation in general.app_command
commands. (Add global checks to app commands #6015)block
/allowlist
settings, possibly thepermissions
cog, and possibly discord permissions.Have the changes in this PR been tested?
Lightly