Skip to content

Slash/Application Commands #219

@rubellyte

Description

@rubellyte

Application commands are the way Discord wants us to handle input from users. They come with some fancy features too, but we'd have to put quite a bit of work into rewriting our existing stuff to work with them.

Goals:

  • Get slash commands working
  • Dynamic registration and deregistration based on enabled commands per guild
  • Ideally, still allow the old text commands to function
  • Text command permissions would be synced with their equivalent app command permissions

Benefits:

  • Increased command discoverability and ease of use
  • Type-hinting so users get real-time feedback on their commands
  • We get to use interaction responses, which include things like buttons and modal prompts - much more ergonomic

Challenges:

  • discord.py's solution for application commands uses a function's type signatures to automatically determine the type hints for Discord. This will require some rewriting, as at present our commands just take a Message object and do all the processing themselves. Two options:
    • The lazy way: Rewrite our command functions to take an Interaction (which we can fake) and a text field. Things work mostly the way they already did, but there's no good typehinting/autocomplete on the Discord end, which loses out on some of the nice things slash commands offer.
    • The right way: Rewrite our command functions with proper arguments and type signatures. This will require some significant adjustments to our command code, and a lot more processing to be done by the command dispatcher on text commands. The end result is probably something more elegant though, and it gives us all the niceties of slash commands.
  • We're limited to 100 slash commands per guild. I don't know how many commands we have, but I think we exceed that number. Solving this will probably require some consolidation of commands - we are allowed 25 subcommands per command.
  • Application commands may have less context available. I actually don't think this is a real problem, but it is something I vaguely worry about.
  • When using the advanced interaction features of application commands, it may be difficult to backport those features to text commands - and I'd prefer to maintain equivalent capability, if not necessarily ease of use.

All in all, something to consider for the next major release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureThis describes or implements a new requested featureMajorThis is important and should be considered high-priorityOn holdThis issue is not being worked on at presentReworkThis describes or implements a code rewrite or refactor

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions