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

Register slash commands #148

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Register slash commands #148

wants to merge 11 commits into from

Conversation

nickserv
Copy link
Member

@nickserv nickserv commented Jan 2, 2022

No description provided.

It's easier to remove it from commandsList as it can't be registered as a slash command.
This makes it easier to register them as both our existing ! commands and slash commands.
@nickserv nickserv linked an issue Jan 2, 2022 that may be closed by this pull request
Commands with arguments make implementing slash commands in a back compatible way more challenging, so I'll fix them later.
@nickserv
Copy link
Member Author

nickserv commented Jan 6, 2022

I've pushed my slash command registration code if anyone would like to review or test it. For some reason the bot commands keep disappearing from Discord, so I'm still trying to work out some bugs.

@vcarl
Copy link
Member

vcarl commented Jan 25, 2022

@nickmccurdy what help testing do you need? I can smoke test, but I see there are some conflicts. Do you want to resolve or should I take a look? I think it's because of the @everyone consolidation, it's all under spam handling now

@@ -54,6 +62,18 @@ bot

if (bot.application) {
const { id } = bot.application;

await api.put(Routes.applicationCommands(id), {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something else we may want to add, this is update-only. Might want to make sure we handle deleted commands too, by comparing api.get(Routes.applicationCommands(id)) with the list of commands in the code

@nickserv
Copy link
Member Author

nickserv commented Jan 25, 2022

I'm aware of the conflicts, I'll fix them.

I was referring to manually testing the slash commands on Discord. They seem to be pretty unpredictable. Specifically, if you try to list commands, the Reactibot commands will rapidly flash on and off. I'm guessing it's either a Discord bug or undefined behavior in the API. You can experiment with it in another branch if you want, but I have some ideas I'll be trying as well.

@nickserv
Copy link
Member Author

nickserv commented Jan 25, 2022

The commands show up consistently when typing / now, but I'm not sure why Discord is claiming the command itself fails to send when the bot is actually receiving it and successfully responding.

image

My guess is that it will fix itself in an hour (the TTL of Discord's slash commands) but I don't have the time to wait right now.

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

Successfully merging this pull request may close these issues.

Convert !commands to slash commands
2 participants