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
T
A 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
command
CommandInfoThe 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
command
CommandInfoThe 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
command
CommandInfoThe 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
command
CommandInfoThe 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
commandService
CommandServiceThe CommandService used to create the module.
builder
ModuleBuilderThe 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
message
stringContents of the message; optional only if
embed
is specified.isTTS
boolSpecifies if Discord should read this
message
aloud using text-to-speech.embed
EmbedAn embed to be displayed alongside the
message
.options
RequestOptionsThe request options for this async request.
allowedMentions
AllowedMentionsSpecifies if notifications are sent for mentioned users and roles in the
message
. If null, all mentioned roles and users will be notified.messageReference
MessageReferenceThe message references to be included. Used to reply to specific messages.
components
MessageComponentThe message components to be included with this message. Used for interactions.
stickers
ISticker[]A collection of stickers to send with the file.
embeds
Embed[]A array of Embeds to send with this response. Max 10.
flags
MessageFlagsMessage flags combined as a bitfield.