Builders for application command options, imported by use Lingo.Bot.
command "search", "Search the catalog",
options: [
string(:query, "What to look for", required: true, autocomplete: true),
integer(:limit, "How many results", min_value: 1, max_value: 25),
channel(:where, "Channel to post in", channel_types: [:guild_text])
]Names may be atoms or strings. Every builder takes these options:
:required- must be filled in (defaultfalse):choices- for strings and numbers, a fixed list of%{name:, value:}maps or[name:, value:]keyword lists:autocomplete- suggest values fromLingo.Bot.handle_autocomplete/2:min_value,:max_value- bounds forinteger/3andnumber/3:min_length,:max_length- bounds forstring/3:channel_types- channel typeschannel/3accepts:file_types- file extensionsattachment/3accepts, like".pdf"(Discord only checks the name):options- the nested options ofsubcommand/3andsubcommand_group/3:name_localizations,:description_localizations- maps of locale to text
Summary
Functions
A file option. Its value is the id; Lingo.Context.get_attachment/2 resolves it.
A true/false option.
A channel option. Its value is the id; Lingo.Context.get_channel/2 resolves it.
An integer option.
A user or role option. Its value is the id.
A number option; the value may be a float.
A role option. Its value is the id; Lingo.Context.get_role/2 resolves it.
A text option.
A subcommand; its own options go in :options.
A group of subcommands, listed in :options.
A user option. Its value is the id; Lingo.Context.get_user/2 resolves it.
Types
Functions
@spec attachment(name(), String.t(), keyword()) :: Lingo.Type.CommandOption.t()
A file option. Its value is the id; Lingo.Context.get_attachment/2 resolves it.
@spec boolean(name(), String.t(), keyword()) :: Lingo.Type.CommandOption.t()
A true/false option.
@spec channel(name(), String.t(), keyword()) :: Lingo.Type.CommandOption.t()
A channel option. Its value is the id; Lingo.Context.get_channel/2 resolves it.
@spec integer(name(), String.t(), keyword()) :: Lingo.Type.CommandOption.t()
An integer option.
@spec mentionable(name(), String.t(), keyword()) :: Lingo.Type.CommandOption.t()
A user or role option. Its value is the id.
@spec number(name(), String.t(), keyword()) :: Lingo.Type.CommandOption.t()
A number option; the value may be a float.
@spec role(name(), String.t(), keyword()) :: Lingo.Type.CommandOption.t()
A role option. Its value is the id; Lingo.Context.get_role/2 resolves it.
@spec string(name(), String.t(), keyword()) :: Lingo.Type.CommandOption.t()
A text option.
@spec subcommand(name(), String.t(), keyword()) :: Lingo.Type.CommandOption.t()
A subcommand; its own options go in :options.
@spec subcommand_group(name(), String.t(), keyword()) :: Lingo.Type.CommandOption.t()
A group of subcommands, listed in :options.
@spec user(name(), String.t(), keyword()) :: Lingo.Type.CommandOption.t()
A user option. Its value is the id; Lingo.Context.get_user/2 resolves it.