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
DiscordRestClientThe discord client.
config
InteractionServiceConfigThe configuration class.
InteractionService(IRestClientProvider, InteractionServiceConfig)
Initialize a InteractionService with provided configurations.
public InteractionService(IRestClientProvider discordProvider, InteractionServiceConfig config = null)
Parameters
discordProvider
IRestClientProviderThe discord client provider.
config
InteractionServiceConfigThe configuration class.
Properties
ComponentCommands
Represents all Component Commands loaded within InteractionService.
public IReadOnlyCollection<ComponentCommandInfo> ComponentCommands { get; }
Property Value
ContextCommands
Represents all Context Commands loaded within InteractionService.
public IReadOnlyList<ContextCommandInfo> ContextCommands { get; }
Property Value
LocalizationManager
Get the ILocalizationManager used by this Interaction Service instance to localize strings.
public ILocalizationManager LocalizationManager { get; set; }
Property Value
ModalCommands
Represents all Modal Commands loaded within InteractionService.
public IReadOnlyCollection<ModalCommandInfo> ModalCommands { get; }
Property Value
Modals
Gets a collection of the cached ModalInfo classes that are referenced in registered ModalCommandInfos.
public IReadOnlyCollection<ModalInfo> Modals { get; }
Property Value
Modules
Represents all modules loaded within InteractionService.
public IReadOnlyList<ModuleInfo> Modules { get; }
Property Value
RestClient
Rest client to be used to register application commands.
public DiscordRestClient RestClient { get; }
Property Value
SlashCommands
Represents all Slash Commands loaded within InteractionService.
public IReadOnlyList<SlashCommandInfo> SlashCommands { get; }
Property Value
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
boolIf 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
IGuildThe target guild.
deleteMissing
boolIf 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
ulongThe target guild ID.
deleteMissing
boolIf 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
TypePrimary target Type of the ComponentTypeConverter.
converter
ComponentTypeConverterThe ComponentTypeConverter instance.
AddComponentTypeConverter<T>(ComponentTypeConverter)
Add a concrete type ComponentTypeConverter.
public void AddComponentTypeConverter<T>(ComponentTypeConverter converter)
Parameters
converter
ComponentTypeConverterThe 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
TypeGeneric Type constraint of the Type of the ComponentTypeConverter<T>.
converterType
TypeType of the ComponentTypeConverter<T>.
AddGenericComponentTypeConverter<T>(Type)
Add a generic type ComponentTypeConverter<T>.
public void AddGenericComponentTypeConverter<T>(Type converterType)
Parameters
converterType
TypeType 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
TypeGeneric Type constraint of the Type of the TypeConverter<T>.
converterType
TypeType of the TypeConverter<T>.
AddGenericTypeConverter<T>(Type)
Add a generic type TypeConverter<T>.
public void AddGenericTypeConverter<T>(Type converterType)
Parameters
converterType
TypeType 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
TypeGeneric Type constraint of the Type of the TypeReader<T>.
readerType
TypeType of the TypeReader<T>.
AddGenericTypeReader<T>(Type)
Add a generic type TypeReader<T>.
public void AddGenericTypeReader<T>(Type readerType)
Parameters
readerType
TypeType of the TypeReader<T>.
Type Parameters
T
Generic Type constraint of the Type of the TypeReader<T>.
AddModalInfo<T>()
public ModalInfo AddModalInfo<T>() where T : class, IModal
Returns
Type Parameters
T
Type of IModal to be loaded.
Exceptions
AddModuleAsync(Type, IServiceProvider)
Add a command module from a Type.
public Task<ModuleInfo> AddModuleAsync(Type type, IServiceProvider services)
Parameters
type
TypeType of the module.
services
IServiceProviderThe 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
IServiceProviderThe 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
AssemblyAssembly the command modules are defined in.
services
IServiceProviderThe 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
boolIf 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
IGuildThe target guild.
deleteMissing
boolIf 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
ulongThe target guild ID.
deleteMissing
boolIf 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
TypePrimary target Type of the TypeConverter.
converter
TypeConverterThe TypeConverter instance.
AddTypeConverter<T>(TypeConverter)
Add a concrete type TypeConverter.
public void AddTypeConverter<T>(TypeConverter converter)
Parameters
converter
TypeConverterThe 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
TypePrimary target Type of the TypeReader.
reader
TypeReaderThe TypeReader instance.
AddTypeReader<T>(TypeReader)
Add a concrete type TypeReader.
public void AddTypeReader<T>(TypeReader reader)
Parameters
reader
TypeReaderThe 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
stringName of the module.
services
IServiceProviderThe 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
IInteractionContextName context of the command.
services
IServiceProviderThe 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
stringA composite format string.
services
IServiceProviderServices 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)
Gets a ComponentCommandInfo.
public ComponentCommandInfo GetComponentCommandInfo<TModule>(string methodName) where TModule : class
Parameters
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)
Gets a ContextCommandInfo.
public ContextCommandInfo GetContextCommandInfo<TModule>(string methodName) where TModule : class
Parameters
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)
Gets a SlashCommandInfo.
public SlashCommandInfo GetSlashCommandInfo<TModule>(string methodName) where TModule : class
Parameters
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
ContextCommandInfoThe Context Command.
guild
IGuildTarget 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
ContextCommandInfoThe Context Command.
guildId
ulongTarget 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
ModuleInfoModule representing the top level Slash Command.
guild
IGuildTarget 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
ModuleInfoModule representing the top level Slash Command.
guildId
ulongTarget 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
SlashCommandInfoThe Slash Command.
guild
IGuildTarget 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
SlashCommandInfoThe Slash Command.
guildId
ulongTarget 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
boolIf 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
ulongId of the target guild.
deleteMissing
boolIf 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
ModuleInfoThe 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
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
IGuildThe 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
ulongThe 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
IAutocompleteInteractionInteraction 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
IComponentInteractionInteraction 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
IMessageCommandInteractionInteraction 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
ISlashCommandInteractionInteraction 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
IUserCommandInteractionInteraction 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
TObject to be serialized.
services
IServiceProviderServices 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
TypeThe type to remove the reader from.
readerType
TypeThe readers type if the remove operation was successful.
Returns
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
TypeThe removed readers type.
Returns
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
TypeThe type to remove the reader from.
reader
TypeReaderThe reader if the resulting remove operation was successful.
Returns
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
TypeReaderThe reader if the resulting remove operation was successful.
Returns
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
AutocompleteHandlerExecuted
Occurs when a AutocompleteHandler is executed.
public event Func<IAutocompleteHandler, IInteractionContext, IResult, Task> AutocompleteHandlerExecuted
Event Type
ComponentCommandExecuted
Occurs when a Message Component command is executed.
public event Func<ComponentCommandInfo, IInteractionContext, IResult, Task> ComponentCommandExecuted
Event Type
ContextCommandExecuted
Occurs when a Context Command is executed.
public event Func<ContextCommandInfo, IInteractionContext, IResult, Task> ContextCommandExecuted
Event Type
InteractionExecuted
Occurs when any type of interaction is executed.
public event Func<ICommandInfo, IInteractionContext, IResult, Task> InteractionExecuted
Event Type
Log
Occurs when a Slash Command related information is received.
public event Func<LogMessage, Task> Log
Event Type
ModalCommandExecuted
Occurs when a Modal command is executed.
public event Func<ModalCommandInfo, IInteractionContext, IResult, Task> ModalCommandExecuted
Event Type
SlashCommandExecuted
Occurs when a Slash Command is executed.
public event Func<SlashCommandInfo, IInteractionContext, IResult, Task> SlashCommandExecuted