Table of Contents

Class ModuleBase<T>

Namespace
Discord.Commands
Assembly
Discord.Net.Commands.dll

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 CommandInfo

The 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 CommandInfo

The CommandInfo of the command to be executed.

Returns

Task

BeforeExecute(CommandInfo)

The method to execute before executing the command.

protected virtual void BeforeExecute(CommandInfo command)

Parameters

command CommandInfo

The 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 CommandInfo

The CommandInfo of the command to be executed.

Returns

Task

OnModuleBuilding(CommandService, ModuleBuilder)

The method to execute when building the module.

protected virtual void OnModuleBuilding(CommandService commandService, ModuleBuilder builder)

Parameters

commandService CommandService

The CommandService used to create the module.

builder ModuleBuilder

The 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 string

Contents of the message; optional only if embed is specified.

isTTS bool

Specifies if Discord should read this message aloud using text-to-speech.

embed Embed

An embed to be displayed alongside the message.

options RequestOptions

The request options for this async request.

allowedMentions AllowedMentions

Specifies if notifications are sent for mentioned users and roles in the message. If null, all mentioned roles and users will be notified.

messageReference MessageReference

The message references to be included. Used to reply to specific messages.

components MessageComponent

The 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 MessageFlags

Message flags combined as a bitfield.

Returns

Task<IUserMessage>