-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
I will start by saying I am very new to Elixir, so this may not be a problem to those more comfortable with the language. Anyways, I was trying to add some sub-commands earlier, and got quite confused when trying to get them to work.
They are mentioned a few times in the Nosedrum documentation, such as in the specs of Nosedrum.ApplicationCommand's option struct, or the docs for the application_command_path struct on Nosedrum.Storage, but how one would actually use them in the context of Nosedrum is fairly opaque.
Including the options method and command method(s) of a module that implements subcommands could prove very useful.
Here is an example from my testing:
@impl true
def options() do
[
%{
type: :sub_command,
name: "sub_test",
description: "This is a subcommand"
},
%{
type: :sub_command,
name: "sub_test2",
description: "This is another subcommand"
}
]
end
@impl true
def command(%Interaction{data: %{options: [%{name: "sub_test"}]}}), do: [content: "XX"]
def command(%Interaction{data: %{options: [%{name: "sub_test2"}]}}), do: [content: "YY"]Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels