-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Turn AoC commands into hybrid commands #101
base: main
Are you sure you want to change the base?
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.
Making this into a hybrid command should cut down on code duplication. I believe Kat wanted them to be hybrid anyway, so that works out nicely. Do you mind condensing the slash command and text command into a hybrid command?
You can't turn individual commandss into hybrid commands afaict, but using a hybrid group should turn all the commands into hybrid commands, which should work anyway. |
&aoc countdown
The latest commits should turn all the AoC commands into hybrid commands. Everything looks ok from my testing other than the channel restrictions, which don't work for text commands on my bot either, so it seems like something to do with my environment. |
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.
So an issue with the current approach, is that &aoc link
still works as a regular command and is not ephemeral only. I would like to convert this completely over to a slash-only is possible. If it's not the most feasible then that's fine.
Additionally, with the hybrid group, I would prefer the prefix to be /aoc
instead of the wordy /adventofcode
For the channel restrictions, that's not working because we're missing code that wraps the extensions with the whitelist command.
Sir-Lancebot runs very restricted and each command is restricted and then given an channel overrides: https://github.com/python-discord/sir-lancebot/blob/main/bot/__main__.py#L76-L80
I'm okay with taking a similar approach and stealing that functionality/code-snippet from Sir-Lancebot.
You will run into an issue with a missing code jam constant if you do run it, so feel free to create a new constant for the Code Jam categories:
class Categories(NamedTuple):
codejam_categories_name = "CODE JAM"
We will have to adapt the output when a command is run doesn't pass the role check. Currently this is the output:
Pushed commit 619a1db that makes link/unlink commands slash-command only as requested by Kat. Would like some feedback here on the technical side - I've used the self.app_command = app_commands.Group(
name=self._locale_name or self.name,
description=self._locale_description or self.description or self.short_doc or '…',
guild_ids=guild_ids,
guild_only=guild_only,
default_permissions=default_permissions,
nsfw=nsfw,
) |
Closes #97
I feel like duplicating the code isn't the best way to go about this, but I couldn't really think of anything else. Any suggestions to avoid it are welcome.