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
TType 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
ephemeralbooltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
optionsRequestOptionsThe 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, MessageFlags)
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, MessageFlags flags = MessageFlags.None)
Parameters
textstringThe text of the message to be sent.
embedsEmbed[]A array of embeds to send with this response. Max 10.
isTTSbooltrue if the message should be read out by a text-to-speech reader, otherwise false.
ephemeralbooltrue if the response should be hidden to everyone besides the invoker of the command, otherwise false.
allowedMentionsAllowedMentionsThe allowed mentions for this response.
optionsRequestOptionsThe request options for this response.
componentsMessageComponentA MessageComponent to be sent with this response.
embedEmbedA single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.
pollPollPropertiesflagsMessageFlags
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
modalModalThe modal to respond with.
optionsRequestOptionsThe 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
customIdstringThe custom ID of the modal.
optionsRequestOptionsThe request options for this async request.
modifyModalAction<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
customIdstringThe custom ID of the modal.
modalTModalThe modal to respond with.
optionsRequestOptionsThe request options for this async request.
modifyModalAction<ModalBuilder>Delegate that can be used to modify the modal.
Returns
- Task
A Task representing the operation of creating the interaction response.
Type Parameters
TModalThe type of the modal.
Exceptions
- InvalidOperationException
Thrown if the interaction isn't a type of RestInteraction.