python-discord / sir-robin

Our event bot, for managing community events.
MIT License
18 stars 14 forks source link

Turn AoC commands into hybrid commands #101

Open n0Oo0Oo0b opened 1 year ago

n0Oo0Oo0b commented 1 year ago

Closes #97

image

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.

n0Oo0Oo0b commented 12 months ago

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. I was initially avoiding doing this since I didn't know you could send ephemeral messages with them. But the ephemeral kwarg in ctx.send can do that, so I think this should be the best way to go.

n0Oo0Oo0b commented 12 months ago

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.

Robin5605 commented 11 months ago

Pushed commit https://github.com/python-discord/sir-robin/pull/101/commits/619a1db4de522892e6b2c6d421f25846c50d601d 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 app_command property of discord.ext.commands.HybridGroup, in order to make a slash-only command under the existing hybrid group. However, the issue here is that this app_command property is not publicly documented, and seems to be an "internal" attribute (I'm not 100% sure it's not prefixed with _ as most of discord.py's other private attributes are): https://github.com/Rapptz/discord.py/blob/536cf5c01fa4237306eadb29fc32abd65b485205/discord/ext/commands/hybrid.py#L656-L663:

            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,
            )