Class ModuleBase<T>
Provides a base class for a command module to inherit from.
public abstract class ModuleBase<T> : IModuleBase where T : class, ICommandContext
Type Parameters
TA class that implements ICommandContext.
- Inheritance
-
ModuleBase<T>
- Implements
- Derived
- Inherited Members
Properties
Context
The underlying context of the command.
public T Context { get; }
Property Value
- T
- See Also
Methods
AfterExecute(CommandInfo)
The method to execute after executing the command.
protected virtual void AfterExecute(CommandInfo command)
Parameters
commandCommandInfoThe CommandInfo of the command to be executed.
AfterExecuteAsync(CommandInfo)
The method to execute asynchronously after executing the command.
protected virtual Task AfterExecuteAsync(CommandInfo command)
Parameters
commandCommandInfoThe CommandInfo of the command to be executed.
Returns
BeforeExecute(CommandInfo)
The method to execute before executing the command.
protected virtual void BeforeExecute(CommandInfo command)
Parameters
commandCommandInfoThe CommandInfo of the command to be executed.
BeforeExecuteAsync(CommandInfo)
The method to execute asynchronously before executing the command.
protected virtual Task BeforeExecuteAsync(CommandInfo command)
Parameters
commandCommandInfoThe CommandInfo of the command to be executed.
Returns
OnModuleBuilding(CommandService, ModuleBuilder)
The method to execute when building the module.
protected virtual void OnModuleBuilding(CommandService commandService, ModuleBuilder builder)
Parameters
commandServiceCommandServiceThe CommandService used to create the module.
builderModuleBuilderThe builder used to build the module.
ReplyAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)
Sends a message to the source channel.
protected virtual Task<IUserMessage> ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
Parameters
messagestringContents of the message; optional only if
embedis specified.isTTSboolSpecifies if Discord should read this
messagealoud using text-to-speech.embedEmbedAn embed to be displayed alongside the
message.optionsRequestOptionsThe request options for this async request.
allowedMentionsAllowedMentionsSpecifies if notifications are sent for mentioned users and roles in the
message. If null, all mentioned roles and users will be notified.messageReferenceMessageReferenceThe message references to be included. Used to reply to specific messages.
componentsMessageComponentThe message components to be included with this message. Used for interactions.
stickersISticker[]A collection of stickers to send with the file.
embedsEmbed[]A array of Embeds to send with this response. Max 10.
flagsMessageFlagsMessage flags combined as a bitfield.