ApplicationCommandExecutor¶
Description¶
Represents a class which contains methods for handle application commands.
Methods¶
return type | signature |
---|---|
ApplicationCommandExecutor.MessageComponentAwaiter | await_components ( int message_id, int timeout, int repeat=-1 ) |
void | _on_slash_command ( DiscordSlashCommand _command ) virtual |
void | _on_user_command ( DiscordUserCommand _command ) virtual |
void | _on_message_command ( DiscordMessageCommand _command ) virtual |
void | _on_autocomplete ( DiscordAutocompleteInteraction _interaction ) virtual |
Method Descriptions¶
-
ApplicationCommandExecutor.MessageComponentAwaiter await_components ( int message_id, int timeout, int repeat=-1 )
Waits for message components interaction event, based on a
message_id
,timeout
time in milliseconds and an optionalrepeat
count of how many events to catch.
-
void _on_slash_command ( DiscordSlashCommand _command ) virtual
Called when a slash command interaction is recieved.
-
void _on_user_command ( DiscordUserCommand _command ) virtual
Called when a user command interaction is recieved.
-
void _on_message_command ( DiscordMessageCommand _command ) virtual
Called when a message command interaction is recieved.
-
void _on_autocomplete ( DiscordAutocompleteInteraction _interaction ) virtual
Called when a autocomplete interaction is recieved.
Sub Classes¶
MessageComponentAwaiter¶
Description¶
Helper class to listen for message components interaction events of a single message.
example usage:
var message_id: int = 1234567890
var timeout_id: int = 20_000 # 20 seconds
var awaiter := await_components(message_id, 20_000)
while yield(awaiter.wait(), "completed"):
var event := awaiter.get_event()
match event.data.custom_id:
"hello":
event.create_reply("hello").submit()
"bye":
event.create_reply("Good bye").submit()
# Timedout
Methods¶
return type | signature |
---|---|
bool | wait ( ) coroutine |
DiscordMessageComponentInteraction | get_event ( ) |
Signals¶
Method Descriptions¶
-
bool wait ( ) coroutine
Waits for a message components event. Returns
false
on timeout or whenrepeat
count reaches0
.
-
DiscordMessageComponentInteraction get_event ( )
Gets the interaction event after
wait()
has returnedtrue
.