Remora / Remora.Discord

A data-oriented C# Discord library, focused on high-performance concurrency and robust design.
GNU Lesser General Public License v3.0
246 stars 44 forks source link

Ability to opt out of text commands #320

Closed Octol1ttle closed 8 months ago

Octol1ttle commented 8 months ago

Description

ServiceCollectionExtensions#AddDiscordCommands can add two types of commands: text commands (default prefix is !) and slash commands (enabled using an argument). While the argument can be used to opt out of slash commands, there's no easy way to opt out of text commands. Furthermore, the documentation for Remora.Discord.Commands doesn't explicitly mention text commands or the way they can be called, which can cause some users (like me) to think that they are not enabled.

I propose to add a second argument to AddDiscordCommands to allow disabling text commands while keeping slash. Other possible implementations I could think of (but probably aren't good in practice :smile:) are: splitting the method into two or more (AddDiscordTextCommands, AddDiscordSlashCommands) or using an approach similar to adding command groups (WithDiscordCommandTypes().AddText(), WithDiscordCommandTypes().AddSlash())

Why This is Needed

Some users may not want to use text commands, as they lack some features of slash commands, like client-side input validation.

Alternatives Considered

A solution that would allow users to fine tune which commands are text, slash or both would be to add two new attributes: [SlashOnly] and [TextOnly].

Additional Details

No response

Nihlus commented 8 months ago

I took a quick dive into the available options, and you can pass useDefaultCommandResponder as false to elide addition of the default text handler. Closing.