Table of Contents

Class InteractionService

Namespace
Discord.Interactions
Assembly
Discord.Net.Interactions.dll

Provides the framework for building and registering Discord Application Commands.

public class InteractionService : IDisposable
Inheritance
InteractionService
Implements
Inherited Members

Constructors

InteractionService(DiscordRestClient, InteractionServiceConfig)

Initialize a InteractionService with provided configurations.

public InteractionService(DiscordRestClient discord, InteractionServiceConfig config = null)

Parameters

discord DiscordRestClient

The discord client.

config InteractionServiceConfig

The configuration class.

InteractionService(IRestClientProvider, InteractionServiceConfig)

Initialize a InteractionService with provided configurations.

public InteractionService(IRestClientProvider discordProvider, InteractionServiceConfig config = null)

Parameters

discordProvider IRestClientProvider

The discord client provider.

config InteractionServiceConfig

The configuration class.

Properties

ComponentCommands

Represents all Component Commands loaded within InteractionService.

public IReadOnlyCollection<ComponentCommandInfo> ComponentCommands { get; }

Property Value

IReadOnlyCollection<ComponentCommandInfo>

ContextCommands

Represents all Context Commands loaded within InteractionService.

public IReadOnlyList<ContextCommandInfo> ContextCommands { get; }

Property Value

IReadOnlyList<ContextCommandInfo>

LocalizationManager

Get the ILocalizationManager used by this Interaction Service instance to localize strings.

public ILocalizationManager LocalizationManager { get; set; }

Property Value

ILocalizationManager

ModalCommands

Represents all Modal Commands loaded within InteractionService.

public IReadOnlyCollection<ModalCommandInfo> ModalCommands { get; }

Property Value

IReadOnlyCollection<ModalCommandInfo>

Modals

Gets a collection of the cached ModalInfo classes that are referenced in registered ModalCommandInfos.

public IReadOnlyCollection<ModalInfo> Modals { get; }

Property Value

IReadOnlyCollection<ModalInfo>

Modules

Represents all modules loaded within InteractionService.

public IReadOnlyList<ModuleInfo> Modules { get; }

Property Value

IReadOnlyList<ModuleInfo>

RestClient

Rest client to be used to register application commands.

public DiscordRestClient RestClient { get; }

Property Value

DiscordRestClient

SlashCommands

Represents all Slash Commands loaded within InteractionService.

public IReadOnlyList<SlashCommandInfo> SlashCommands { get; }

Property Value

IReadOnlyList<SlashCommandInfo>

Methods

AddCommandsGloballyAsync(bool, params IApplicationCommandInfo[])

Register Application Commands from commands as global commands.

public Task<IReadOnlyCollection<RestGlobalCommand>> AddCommandsGloballyAsync(bool deleteMissing = false, params IApplicationCommandInfo[] commands)

Parameters

deleteMissing bool

If false, this operation will not delete the commands that are missing from InteractionService.

commands IApplicationCommandInfo[]

Commands to be registered to Discord.

Returns

Task<IReadOnlyCollection<RestGlobalCommand>>

A task representing the command registration process. The task result contains the active application commands of the target guild.

Remarks

Commands will be registered as standalone commands, if you want the GroupAttribute to take effect, use AddModulesToGuildAsync(IGuild, bool, params ModuleInfo[]). Registering a commands without group names might cause the command traversal to fail.

AddCommandsToGuildAsync(IGuild, bool, params ICommandInfo[])

Register Application Commands from commands to a guild.

public Task<IReadOnlyCollection<RestGuildCommand>> AddCommandsToGuildAsync(IGuild guild, bool deleteMissing = false, params ICommandInfo[] commands)

Parameters

guild IGuild

The target guild.

deleteMissing bool

If false, this operation will not delete the commands that are missing from InteractionService.

commands ICommandInfo[]

Commands to be registered to Discord.

Returns

Task<IReadOnlyCollection<RestGuildCommand>>

A task representing the command registration process. The task result contains the active application commands of the target guild.

Remarks

Commands will be registered as standalone commands, if you want the GroupAttribute to take effect, use AddModulesToGuildAsync(IGuild, bool, params ModuleInfo[]). Registering a commands without group names might cause the command traversal to fail.

AddCommandsToGuildAsync(ulong, bool, params ICommandInfo[])

Register Application Commands from commands to a guild.

public Task<IReadOnlyCollection<RestGuildCommand>> AddCommandsToGuildAsync(ulong guildId, bool deleteMissing = false, params ICommandInfo[] commands)

Parameters

guildId ulong

The target guild ID.

deleteMissing bool

If false, this operation will not delete the commands that are missing from InteractionService.

commands ICommandInfo[]

Commands to be registered to Discord.

Returns

Task<IReadOnlyCollection<RestGuildCommand>>

A task representing the command registration process. The task result contains the active application commands of the target guild.

Remarks

Commands will be registered as standalone commands, if you want the GroupAttribute to take effect, use AddModulesToGuildAsync(ulong, bool, params ModuleInfo[]). Registering a commands without group names might cause the command traversal to fail.

AddComponentTypeConverter(Type, ComponentTypeConverter)

Add a concrete type ComponentTypeConverter.

public void AddComponentTypeConverter(Type type, ComponentTypeConverter converter)

Parameters

type Type

Primary target Type of the ComponentTypeConverter.

converter ComponentTypeConverter

The ComponentTypeConverter instance.

AddComponentTypeConverter<T>(ComponentTypeConverter)

Add a concrete type ComponentTypeConverter.

public void AddComponentTypeConverter<T>(ComponentTypeConverter converter)

Parameters

converter ComponentTypeConverter

The ComponentTypeConverter instance.

Type Parameters

T

Primary target Type of the ComponentTypeConverter.

AddGenericComponentTypeConverter(Type, Type)

Add a generic type ComponentTypeConverter<T>.

public void AddGenericComponentTypeConverter(Type targetType, Type converterType)

Parameters

targetType Type

Generic Type constraint of the Type of the ComponentTypeConverter<T>.

converterType Type

Type of the ComponentTypeConverter<T>.

AddGenericComponentTypeConverter<T>(Type)

Add a generic type ComponentTypeConverter<T>.

public void AddGenericComponentTypeConverter<T>(Type converterType)

Parameters

converterType Type

Type of the ComponentTypeConverter<T>.

Type Parameters

T

Generic Type constraint of the Type of the ComponentTypeConverter<T>.

AddGenericTypeConverter(Type, Type)

Add a generic type TypeConverter<T>.

public void AddGenericTypeConverter(Type targetType, Type converterType)

Parameters

targetType Type

Generic Type constraint of the Type of the TypeConverter<T>.

converterType Type

Type of the TypeConverter<T>.

AddGenericTypeConverter<T>(Type)

Add a generic type TypeConverter<T>.

public void AddGenericTypeConverter<T>(Type converterType)

Parameters

converterType Type

Type of the TypeConverter<T>.

Type Parameters

T

Generic Type constraint of the Type of the TypeConverter<T>.

AddGenericTypeReader(Type, Type)

Add a generic type TypeReader<T>.

public void AddGenericTypeReader(Type targetType, Type readerType)

Parameters

targetType Type

Generic Type constraint of the Type of the TypeReader<T>.

readerType Type

Type of the TypeReader<T>.

AddGenericTypeReader<T>(Type)

Add a generic type TypeReader<T>.

public void AddGenericTypeReader<T>(Type readerType)

Parameters

readerType Type

Type of the TypeReader<T>.

Type Parameters

T

Generic Type constraint of the Type of the TypeReader<T>.

AddModalInfo<T>()

Loads and caches an ModalInfo for the provided IModal.

public ModalInfo AddModalInfo<T>() where T : class, IModal

Returns

ModalInfo

The built ModalInfo instance.

Type Parameters

T

Type of IModal to be loaded.

Exceptions

InvalidOperationException

AddModuleAsync(Type, IServiceProvider)

Add a command module from a Type.

public Task<ModuleInfo> AddModuleAsync(Type type, IServiceProvider services)

Parameters

type Type

Type of the module.

services IServiceProvider

The IServiceProvider for your dependency injection solution if using one; otherwise, pass null .

Returns

Task<ModuleInfo>

A task representing the operation for adding the module. The task result contains the built module.

Exceptions

ArgumentException

Thrown if this module has already been added.

InvalidOperationException

Thrown when the type is not a valid module definition.

AddModuleAsync<T>(IServiceProvider)

Add a command module from a Type.

public Task<ModuleInfo> AddModuleAsync<T>(IServiceProvider services) where T : class

Parameters

services IServiceProvider

The IServiceProvider for your dependency injection solution if using one; otherwise, pass null .

Returns

Task<ModuleInfo>

A task representing the operation for adding the module. The task result contains the built module.

Type Parameters

T

Type of the module.

Exceptions

ArgumentException

Thrown if this module has already been added.

InvalidOperationException

Thrown when the T is not a valid module definition.

AddModulesAsync(Assembly, IServiceProvider)

Discover and load command modules from an Assembly.

public Task<IEnumerable<ModuleInfo>> AddModulesAsync(Assembly assembly, IServiceProvider services)

Parameters

assembly Assembly

Assembly the command modules are defined in.

services IServiceProvider

The IServiceProvider for your dependency injection solution if using one; otherwise, pass null.

Returns

Task<IEnumerable<ModuleInfo>>

A task representing the operation for adding modules. The task result contains a collection of the modules added.

AddModulesGloballyAsync(bool, params ModuleInfo[])

Register Application Commands from modules provided in modules as global commands.

public Task<IReadOnlyCollection<RestGlobalCommand>> AddModulesGloballyAsync(bool deleteMissing = false, params ModuleInfo[] modules)

Parameters

deleteMissing bool

If false, this operation will not delete the commands that are missing from InteractionService.

modules ModuleInfo[]

Modules to be registered to Discord.

Returns

Task<IReadOnlyCollection<RestGlobalCommand>>

A task representing the command registration process. The task result contains the active application commands of the target guild.

AddModulesToGuildAsync(IGuild, bool, params ModuleInfo[])

Register Application Commands from modules provided in modules to a guild.

public Task<IReadOnlyCollection<RestGuildCommand>> AddModulesToGuildAsync(IGuild guild, bool deleteMissing = false, params ModuleInfo[] modules)

Parameters

guild IGuild

The target guild.

deleteMissing bool

If false, this operation will not delete the commands that are missing from InteractionService.

modules ModuleInfo[]

Modules to be registered to Discord.

Returns

Task<IReadOnlyCollection<RestGuildCommand>>

A task representing the command registration process. The task result contains the active application commands of the target guild.

AddModulesToGuildAsync(ulong, bool, params ModuleInfo[])

Register Application Commands from modules provided in modules to a guild.

public Task<IReadOnlyCollection<RestGuildCommand>> AddModulesToGuildAsync(ulong guildId, bool deleteMissing = false, params ModuleInfo[] modules)

Parameters

guildId ulong

The target guild ID.

deleteMissing bool

If false, this operation will not delete the commands that are missing from InteractionService.

modules ModuleInfo[]

Modules to be registered to Discord.

Returns

Task<IReadOnlyCollection<RestGuildCommand>>

A task representing the command registration process. The task result contains the active application commands of the target guild.

AddTypeConverter(Type, TypeConverter)

Add a concrete type TypeConverter.

public void AddTypeConverter(Type type, TypeConverter converter)

Parameters

type Type

Primary target Type of the TypeConverter.

converter TypeConverter

The TypeConverter instance.

AddTypeConverter<T>(TypeConverter)

Add a concrete type TypeConverter.

public void AddTypeConverter<T>(TypeConverter converter)

Parameters

converter TypeConverter

The TypeConverter instance.

Type Parameters

T

Primary target Type of the TypeConverter.

AddTypeReader(Type, TypeReader)

Add a concrete type TypeReader.

public void AddTypeReader(Type type, TypeReader reader)

Parameters

type Type

Primary target Type of the TypeReader.

reader TypeReader

The TypeReader instance.

AddTypeReader<T>(TypeReader)

Add a concrete type TypeReader.

public void AddTypeReader<T>(TypeReader reader)

Parameters

reader TypeReader

The TypeReader instance.

Type Parameters

T

Primary target Type of the TypeReader.

CreateModuleAsync(string, IServiceProvider, Action<ModuleBuilder>)

Create and loads a ModuleInfo using a builder factory.

public Task<ModuleInfo> CreateModuleAsync(string name, IServiceProvider services, Action<ModuleBuilder> buildFunc)

Parameters

name string

Name of the module.

services IServiceProvider

The IServiceProvider for your dependency injection solution if using one; otherwise, pass null.

buildFunc Action<ModuleBuilder>

Module builder factory.

Returns

Task<ModuleInfo>

A task representing the operation for adding modules. The task result contains the built module instance.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

ExecuteCommandAsync(IInteractionContext, IServiceProvider)

Execute a Command from a given IInteractionContext.

public Task<IResult> ExecuteCommandAsync(IInteractionContext context, IServiceProvider services)

Parameters

context IInteractionContext

Name context of the command.

services IServiceProvider

The service to be used in the command's dependency injection.

Returns

Task<IResult>

A task representing the command execution process. The task result contains the result of the execution.

GenerateCustomIdStringAsync(string, IServiceProvider, params object[])

Serialize and format multiple objects into a Custom Id string.

public Task<string> GenerateCustomIdStringAsync(string format, IServiceProvider services, params object[] args)

Parameters

format string

A composite format string.

services IServiceProvider

Services that will be passed on to the TypeReaders.

args object[]

Objects to be serialized.

Returns

Task<string>

A task representing the conversion process. The task result contains the result of the conversion.

GetComponentCommandInfo<TModule>(string)

public ComponentCommandInfo GetComponentCommandInfo<TModule>(string methodName) where TModule : class

Parameters

methodName string

Method name of the handler, use of nameof is recommended.

Returns

ComponentCommandInfo

ComponentCommandInfo instance for this command.

Type Parameters

TModule

Declaring module type of this command, must be a type of InteractionModuleBase<T>.

Exceptions

InvalidOperationException

Module or Component Command couldn't be found.

GetContextCommandInfo<TModule>(string)

public ContextCommandInfo GetContextCommandInfo<TModule>(string methodName) where TModule : class

Parameters

methodName string

Method name of the handler, use of nameof is recommended.

Returns

ContextCommandInfo

ContextCommandInfo instance for this command.

Type Parameters

TModule

Declaring module type of this command, must be a type of InteractionModuleBase<T>.

Exceptions

InvalidOperationException

Module or Context Command couldn't be found.

GetModuleInfo<TModule>()

Gets a built ModuleInfo.

public ModuleInfo GetModuleInfo<TModule>() where TModule : class

Returns

ModuleInfo

ModuleInfo instance for this module.

Type Parameters

TModule

Type of the module, must be a type of InteractionModuleBase<T>.

GetSlashCommandInfo<TModule>(string)

public SlashCommandInfo GetSlashCommandInfo<TModule>(string methodName) where TModule : class

Parameters

methodName string

Method name of the handler, use of nameof is recommended.

Returns

SlashCommandInfo

SlashCommandInfo instance for this command.

Type Parameters

TModule

Declaring module type of this command, must be a type of InteractionModuleBase<T>.

Exceptions

InvalidOperationException

Module or Slash Command couldn't be found.

ModifyContextCommandPermissionsAsync(ContextCommandInfo, IGuild, params ApplicationCommandPermission[])

Modify the command permissions of the matching Discord Slash Command.

public Task<GuildApplicationCommandPermission> ModifyContextCommandPermissionsAsync(ContextCommandInfo command, IGuild guild, params ApplicationCommandPermission[] permissions)

Parameters

command ContextCommandInfo

The Context Command.

guild IGuild

Target guild.

permissions ApplicationCommandPermission[]

New permission values.

Returns

Task<GuildApplicationCommandPermission>

The active command permissions after the modification.

ModifyContextCommandPermissionsAsync(ContextCommandInfo, ulong, params ApplicationCommandPermission[])

Modify the command permissions of the matching Discord Slash Command.

public Task<GuildApplicationCommandPermission> ModifyContextCommandPermissionsAsync(ContextCommandInfo command, ulong guildId, params ApplicationCommandPermission[] permissions)

Parameters

command ContextCommandInfo

The Context Command.

guildId ulong

Target guild ID.

permissions ApplicationCommandPermission[]

New permission values.

Returns

Task<GuildApplicationCommandPermission>

The active command permissions after the modification.

ModifySlashCommandPermissionsAsync(ModuleInfo, IGuild, params ApplicationCommandPermission[])

Modify the command permissions of the matching Discord Slash Command.

public Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(ModuleInfo module, IGuild guild, params ApplicationCommandPermission[] permissions)

Parameters

module ModuleInfo

Module representing the top level Slash Command.

guild IGuild

Target guild.

permissions ApplicationCommandPermission[]

New permission values.

Returns

Task<GuildApplicationCommandPermission>

The active command permissions after the modification.

ModifySlashCommandPermissionsAsync(ModuleInfo, ulong, params ApplicationCommandPermission[])

Modify the command permissions of the matching Discord Slash Command.

public Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(ModuleInfo module, ulong guildId, params ApplicationCommandPermission[] permissions)

Parameters

module ModuleInfo

Module representing the top level Slash Command.

guildId ulong

Target guild ID.

permissions ApplicationCommandPermission[]

New permission values.

Returns

Task<GuildApplicationCommandPermission>

The active command permissions after the modification.

ModifySlashCommandPermissionsAsync(SlashCommandInfo, IGuild, params ApplicationCommandPermission[])

Modify the command permissions of the matching Discord Slash Command.

public Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(SlashCommandInfo command, IGuild guild, params ApplicationCommandPermission[] permissions)

Parameters

command SlashCommandInfo

The Slash Command.

guild IGuild

Target guild.

permissions ApplicationCommandPermission[]

New permission values.

Returns

Task<GuildApplicationCommandPermission>

The active command permissions after the modification.

ModifySlashCommandPermissionsAsync(SlashCommandInfo, ulong, params ApplicationCommandPermission[])

Modify the command permissions of the matching Discord Slash Command.

public Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(SlashCommandInfo command, ulong guildId, params ApplicationCommandPermission[] permissions)

Parameters

command SlashCommandInfo

The Slash Command.

guildId ulong

Target guild ID.

permissions ApplicationCommandPermission[]

New permission values.

Returns

Task<GuildApplicationCommandPermission>

The active command permissions after the modification.

RegisterCommandsGloballyAsync(bool)

Register Application Commands from ContextCommands and SlashCommands to Discord on in global scope.

public Task<IReadOnlyCollection<RestGlobalCommand>> RegisterCommandsGloballyAsync(bool deleteMissing = true)

Parameters

deleteMissing bool

If false, this operation will not delete the commands that are missing from InteractionService.

Returns

Task<IReadOnlyCollection<RestGlobalCommand>>

A task representing the command registration process. The task result contains the active global application commands of bot.

RegisterCommandsToGuildAsync(ulong, bool)

Register Application Commands from ContextCommands and SlashCommands to a guild.

public Task<IReadOnlyCollection<RestGuildCommand>> RegisterCommandsToGuildAsync(ulong guildId, bool deleteMissing = true)

Parameters

guildId ulong

Id of the target guild.

deleteMissing bool

If false, this operation will not delete the commands that are missing from InteractionService.

Returns

Task<IReadOnlyCollection<RestGuildCommand>>

A task representing the command registration process. The task result contains the active application commands of the target guild.

RemoveModuleAsync(ModuleInfo)

Remove a command module.

public Task<bool> RemoveModuleAsync(ModuleInfo module)

Parameters

module ModuleInfo

The ModuleInfo to be removed from the service.

Returns

Task<bool>

A task that represents the asynchronous removal operation. The task result contains a value that indicates whether the module is successfully removed.

RemoveModuleAsync(Type)

Remove a command module.

public Task<bool> RemoveModuleAsync(Type type)

Parameters

type Type

The Type of the module.

Returns

Task<bool>

A task that represents the asynchronous removal operation. The task result contains a value that indicates whether the module is successfully removed.

RemoveModuleAsync<T>()

Remove a command module.

public Task<bool> RemoveModuleAsync<T>()

Returns

Task<bool>

A task that represents the asynchronous removal operation. The task result contains a value that indicates whether the module is successfully removed.

Type Parameters

T

The Type of the module.

RemoveModulesFromGuildAsync(IGuild, params ModuleInfo[])

Unregister Application Commands from modules provided in modules from a guild.

public Task<IReadOnlyCollection<RestGuildCommand>> RemoveModulesFromGuildAsync(IGuild guild, params ModuleInfo[] modules)

Parameters

guild IGuild

The target guild.

modules ModuleInfo[]

Modules to be deregistered from Discord.

Returns

Task<IReadOnlyCollection<RestGuildCommand>>

A task representing the command de-registration process. The task result contains the active application commands of the target guild.

RemoveModulesFromGuildAsync(ulong, params ModuleInfo[])

Unregister Application Commands from modules provided in modules from a guild.

public Task<IReadOnlyCollection<RestGuildCommand>> RemoveModulesFromGuildAsync(ulong guildId, params ModuleInfo[] modules)

Parameters

guildId ulong

The target guild ID.

modules ModuleInfo[]

Modules to be deregistered from Discord.

Returns

Task<IReadOnlyCollection<RestGuildCommand>>

A task representing the command de-registration process. The task result contains the active application commands of the target guild.

SearchAutocompleteCommand(IAutocompleteInteraction)

Search the registered slash commands using a IAutocompleteInteraction.

public SearchResult<AutocompleteCommandInfo> SearchAutocompleteCommand(IAutocompleteInteraction autocompleteInteraction)

Parameters

autocompleteInteraction IAutocompleteInteraction

Interaction entity to perform the search with.

Returns

SearchResult<AutocompleteCommandInfo>

The search result. When successful, result contains the found AutocompleteCommandInfo.

SearchComponentCommand(IComponentInteraction)

Search the registered slash commands using a IComponentInteraction.

public SearchResult<ComponentCommandInfo> SearchComponentCommand(IComponentInteraction componentInteraction)

Parameters

componentInteraction IComponentInteraction

Interaction entity to perform the search with.

Returns

SearchResult<ComponentCommandInfo>

The search result. When successful, result contains the found ComponentCommandInfo.

SearchMessageCommand(IMessageCommandInteraction)

Search the registered slash commands using a IMessageCommandInteraction.

public SearchResult<ContextCommandInfo> SearchMessageCommand(IMessageCommandInteraction messageCommandInteraction)

Parameters

messageCommandInteraction IMessageCommandInteraction

Interaction entity to perform the search with.

Returns

SearchResult<ContextCommandInfo>

The search result. When successful, result contains the found ContextCommandInfo.

SearchSlashCommand(ISlashCommandInteraction)

Search the registered slash commands using a ISlashCommandInteraction.

public SearchResult<SlashCommandInfo> SearchSlashCommand(ISlashCommandInteraction slashCommandInteraction)

Parameters

slashCommandInteraction ISlashCommandInteraction

Interaction entity to perform the search with.

Returns

SearchResult<SlashCommandInfo>

The search result. When successful, result contains the found SlashCommandInfo.

SearchUserCommand(IUserCommandInteraction)

Search the registered slash commands using a IUserCommandInteraction.

public SearchResult<ContextCommandInfo> SearchUserCommand(IUserCommandInteraction userCommandInteraction)

Parameters

userCommandInteraction IUserCommandInteraction

Interaction entity to perform the search with.

Returns

SearchResult<ContextCommandInfo>

The search result. When successful, result contains the found ContextCommandInfo.

SerializeValueAsync<T>(T, IServiceProvider)

Serialize an object using a TypeReader into a string to be placed in a Component CustomId.

public Task<string> SerializeValueAsync<T>(T obj, IServiceProvider services)

Parameters

obj T

Object to be serialized.

services IServiceProvider

Services that will be passed on to the TypeReader.

Returns

Task<string>

A task representing the conversion process. The task result contains the result of the conversion.

Type Parameters

T

Type of the object to be serialized.

Remarks

Removing a TypeReader from the InteractionService will not dereference the TypeReader from the loaded module/command instances. You need to reload the modules for the changes to take effect.

TryRemoveGenericTypeReader(Type, out Type)

Removes a generic type reader from the given type.

public bool TryRemoveGenericTypeReader(Type type, out Type readerType)

Parameters

type Type

The type to remove the reader from.

readerType Type

The readers type if the remove operation was successful.

Returns

bool

true if the remove operation was successful; otherwise false.

Remarks

Removing a TypeReader from the InteractionService will not dereference the TypeReader from the loaded module/command instances. You need to reload the modules for the changes to take effect.

TryRemoveGenericTypeReader<T>(out Type)

Removes a generic type reader from the type T.

public bool TryRemoveGenericTypeReader<T>(out Type readerType)

Parameters

readerType Type

The removed readers type.

Returns

bool

true if the remove operation was successful; otherwise false.

Type Parameters

T

The type to remove the readers from.

Remarks

Removing a TypeReader from the InteractionService will not dereference the TypeReader from the loaded module/command instances. You need to reload the modules for the changes to take effect.

TryRemoveTypeReader(Type, out TypeReader)

Removes a type reader for the given type.

public bool TryRemoveTypeReader(Type type, out TypeReader reader)

Parameters

type Type

The type to remove the reader from.

reader TypeReader

The reader if the resulting remove operation was successful.

Returns

bool

true if the remove operation was successful; otherwise false.

Remarks

Removing a TypeReader from the InteractionService will not dereference the TypeReader from the loaded module/command instances. You need to reload the modules for the changes to take effect.

TryRemoveTypeReader<T>(out TypeReader)

Removes a type reader for the type T.

public bool TryRemoveTypeReader<T>(out TypeReader reader)

Parameters

reader TypeReader

The reader if the resulting remove operation was successful.

Returns

bool

true if the remove operation was successful; otherwise false.

Type Parameters

T

The type to remove the readers from.

Events

AutocompleteCommandExecuted

Occurs when a Autocomplete command is executed.

public event Func<AutocompleteCommandInfo, IInteractionContext, IResult, Task> AutocompleteCommandExecuted

Event Type

Func<AutocompleteCommandInfo, IInteractionContext, IResult, Task>

AutocompleteHandlerExecuted

Occurs when a AutocompleteHandler is executed.

public event Func<IAutocompleteHandler, IInteractionContext, IResult, Task> AutocompleteHandlerExecuted

Event Type

Func<IAutocompleteHandler, IInteractionContext, IResult, Task>

ComponentCommandExecuted

Occurs when a Message Component command is executed.

public event Func<ComponentCommandInfo, IInteractionContext, IResult, Task> ComponentCommandExecuted

Event Type

Func<ComponentCommandInfo, IInteractionContext, IResult, Task>

ContextCommandExecuted

Occurs when a Context Command is executed.

public event Func<ContextCommandInfo, IInteractionContext, IResult, Task> ContextCommandExecuted

Event Type

Func<ContextCommandInfo, IInteractionContext, IResult, Task>

InteractionExecuted

Occurs when any type of interaction is executed.

public event Func<ICommandInfo, IInteractionContext, IResult, Task> InteractionExecuted

Event Type

Func<ICommandInfo, IInteractionContext, IResult, Task>

Log

Occurs when a Slash Command related information is received.

public event Func<LogMessage, Task> Log

Event Type

Func<LogMessage, Task>

ModalCommandExecuted

Occurs when a Modal command is executed.

public event Func<ModalCommandInfo, IInteractionContext, IResult, Task> ModalCommandExecuted

Event Type

Func<ModalCommandInfo, IInteractionContext, IResult, Task>

SlashCommandExecuted

Occurs when a Slash Command is executed.

public event Func<SlashCommandInfo, IInteractionContext, IResult, Task> SlashCommandExecuted

Event Type

Func<SlashCommandInfo, IInteractionContext, IResult, Task>