Class RestInteractionModuleBase<T>
- Namespace
- Discord.Interactions
- Assembly
- Discord.Net.Interactions.dll
Provides a base class for a Rest based command module to inherit from.
public abstract class RestInteractionModuleBase<T> : InteractionModuleBase<T>, IInteractionModuleBase where T : class, IInteractionContext
Type Parameters
T
Type of interaction context to be injected into the module.
- Inheritance
-
RestInteractionModuleBase<T>
- Implements
- Inherited Members
Properties
InteractionService
Gets or sets the underlying Interaction Service.
public InteractionService InteractionService { get; set; }
Property Value
Methods
DeferAsync(bool, RequestOptions)
Defer a Rest based Discord Interaction using the RestResponseCallback delegate.
protected override Task DeferAsync(bool ephemeral = false, RequestOptions options = null)
Parameters
ephemeral
booltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
options
RequestOptionsThe request options for this response.
Returns
- Task
A Task representing the operation of creating the interaction response.
Exceptions
- InvalidOperationException
Thrown if the interaction isn't a type of RestInteraction.
RespondAsync(string, Embed[], bool, bool, AllowedMentions, RequestOptions, MessageComponent, Embed, PollProperties)
Respond to a Rest based Discord Interaction using the RestResponseCallback delegate.
protected override Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, Embed embed = null, PollProperties poll = null)
Parameters
text
stringThe text of the message to be sent.
embeds
Embed[]A array of embeds to send with this response. Max 10.
isTTS
booltrue if the message should be read out by a text-to-speech reader, otherwise false.
ephemeral
booltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
allowedMentions
AllowedMentionsThe allowed mentions for this response.
options
RequestOptionsThe request options for this response.
components
MessageComponentA MessageComponent to be sent with this response.
embed
EmbedA single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
poll
PollProperties
Returns
- Task
A Task representing the operation of creating the interaction response.
Exceptions
- InvalidOperationException
Thrown if the interaction isn't a type of RestInteraction.
RespondWithModalAsync(Modal, RequestOptions)
Responds to the interaction with a modal.
protected override Task RespondWithModalAsync(Modal modal, RequestOptions options = null)
Parameters
modal
ModalThe modal to respond with.
options
RequestOptionsThe request options for this async request.
Returns
- Task
A Task representing the operation of creating the interaction response.
Exceptions
- InvalidOperationException
Thrown if the interaction isn't a type of RestInteraction.
RespondWithModalAsync<TModal>(string, RequestOptions, Action<ModalBuilder>)
Responds to the interaction with a modal.
protected override Task RespondWithModalAsync<TModal>(string customId, RequestOptions options = null, Action<ModalBuilder> modifyModal = null) where TModal : class, IModal
Parameters
customId
stringThe custom ID of the modal.
options
RequestOptionsThe request options for this async request.
modifyModal
Action<ModalBuilder>Delegate that can be used to modify the modal.
Returns
- Task
A Task representing the operation of creating the interaction response.
Type Parameters
TModal
Exceptions
- InvalidOperationException
Thrown if the interaction isn't a type of RestInteraction.
RespondWithModalAsync<TModal>(string, TModal, RequestOptions, Action<ModalBuilder>)
Responds to the interaction with a modal.
protected override Task RespondWithModalAsync<TModal>(string customId, TModal modal, RequestOptions options = null, Action<ModalBuilder> modifyModal = null) where TModal : class, IModal
Parameters
customId
stringThe custom ID of the modal.
modal
TModalThe modal to respond with.
options
RequestOptionsThe request options for this async request.
modifyModal
Action<ModalBuilder>Delegate that can be used to modify the modal.
Returns
- Task
A Task representing the operation of creating the interaction response.
Type Parameters
TModal
The type of the modal.
Exceptions
- InvalidOperationException
Thrown if the interaction isn't a type of RestInteraction.