feat: Add config option to disable Discord slash commands#13130
Closed
fuleinist wants to merge 1 commit into
Closed
feat: Add config option to disable Discord slash commands#13130fuleinist wants to merge 1 commit into
fuleinist wants to merge 1 commit into
Conversation
Add discord.slash_commands config option (default: true) to allow
users to disable Discord slash command registration when running
alongside other bots that use the same command names.
When set to false in config.yaml:
discord:
slash_commands: false
The _register_slash_commands() call is skipped while text-based
parsing of /commands continues to work normally.
Fixes NousResearch#4881
Contributor
|
Thanks @fuleinist! Your feature flag was cherry-picked and merged via #14315 with your authorship preserved. One follow-up tweak applied — the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
discord.slash_commandsconfig option (default:true) to disable Discord slash command registration when running Hermes alongside other bots that use the same command names.Problem
When running Hermes alongside other Discord bots on the same server, Hermes's registered slash commands (e.g.
/stop,/reset,/status) override identical slash commands used by other bots. Discord's slash command autocomplete intercepts input before other bots can parse it as a text message.Text-based parsing of
/commandcontinues to work perfectly without slash commands registered.Solution
Add
discord.slash_commands: falseto config.yaml:When
false,_register_slash_commands()is skipped. The text-based/commandparsing continues to work normally.Changes
gateway/platforms/discord.py: Addedself._slash_commandsinitialization fromconfig.extra.get("slash_commands", True)connect()to conditionally call_register_slash_commands()only when_slash_commandsisTrueFixes #4881