A chapter talking about the interaction service framework.
For questions about interactions in general, refer to the [Interactions FAQ]
Make sure the properties are publicly accessible and publicly settable.
If your interaction context holds a down-casted version of the interaction object, you need to up-cast it.
Ideally, use pattern matching to make sure its the type of interaction you are expecting it to be.
InteractionService.ExecuteAsync()
always returns a successful result, how do i access the failed command execution results?If you are using RunMode.Async
you need to setup your post-execution pipeline around CommandExecuted
events.
Refer to the [documentation about preconditions]
Set the RestResponseCallback
property of [InteractionServiceConfig] with a delegate for handling HTTP Responses and use
RestInteractionModuleBase
to create your command modules. RespondAsync()
and DeferAsync()
methods of this module base will use the
RestResponseCallback
to create interaction responses.
[Choice]
?The default enum
TypeConverter of the Interaction Service will
automatically register enum
s as multiple choice options.
enum
parameter but make the default value not visible to the user?The default enum
TypeConverter of the Interaction Service comes with [Hide]
attribute that
can be used to prevent certain enum values from getting registered.
It compares the target base type key of the
TypeConverter and chooses the one that sits highest on the inheritance hierarchy.
[Interactions FAQ]: xref: FAQ.Basics.Interactions
[InteractionServiceConfig]: xref:Discord.Interactions.InteractionServiceConfig
[documentation about preconditions]: xref: Guides.ChatCommands.Preconditions