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
discordDiscordRestClientThe discord client.
configInteractionServiceConfigThe configuration class.
InteractionService(IRestClientProvider, InteractionServiceConfig)
Initialize a InteractionService with provided configurations.
public InteractionService(IRestClientProvider discordProvider, InteractionServiceConfig config = null)
Parameters
discordProviderIRestClientProviderThe discord client provider.
configInteractionServiceConfigThe 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
deleteMissingboolIf false, this operation will not delete the commands that are missing from InteractionService.
commandsIApplicationCommandInfo[]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
guildIGuildThe target guild.
deleteMissingboolIf false, this operation will not delete the commands that are missing from InteractionService.
commandsICommandInfo[]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
guildIdulongThe target guild ID.
deleteMissingboolIf false, this operation will not delete the commands that are missing from InteractionService.
commandsICommandInfo[]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
typeTypePrimary target Type of the ComponentTypeConverter.
converterComponentTypeConverterThe ComponentTypeConverter instance.
AddComponentTypeConverter<T>(ComponentTypeConverter)
Add a concrete type ComponentTypeConverter.
public void AddComponentTypeConverter<T>(ComponentTypeConverter converter)
Parameters
converterComponentTypeConverterThe ComponentTypeConverter instance.
Type Parameters
TPrimary target Type of the ComponentTypeConverter.
AddGenericComponentTypeConverter(Type, Type)
Add a generic type ComponentTypeConverter<T>.
public void AddGenericComponentTypeConverter(Type targetType, Type converterType)
Parameters
targetTypeTypeGeneric Type constraint of the Type of the ComponentTypeConverter<T>.
converterTypeTypeType of the ComponentTypeConverter<T>.
AddGenericComponentTypeConverter<T>(Type)
Add a generic type ComponentTypeConverter<T>.
public void AddGenericComponentTypeConverter<T>(Type converterType)
Parameters
converterTypeTypeType of the ComponentTypeConverter<T>.
Type Parameters
TGeneric 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
targetTypeTypeGeneric Type constraint of the Type of the TypeConverter<T>.
converterTypeTypeType of the TypeConverter<T>.
AddGenericTypeConverter<T>(Type)
Add a generic type TypeConverter<T>.
public void AddGenericTypeConverter<T>(Type converterType)
Parameters
converterTypeTypeType of the TypeConverter<T>.
Type Parameters
TGeneric 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
targetTypeTypeGeneric Type constraint of the Type of the TypeReader<T>.
readerTypeTypeType of the TypeReader<T>.
AddGenericTypeReader<T>(Type)
Add a generic type TypeReader<T>.
public void AddGenericTypeReader<T>(Type readerType)
Parameters
readerTypeTypeType of the TypeReader<T>.
Type Parameters
TGeneric Type constraint of the Type of the TypeReader<T>.
AddModalInfo<T>()
public ModalInfo AddModalInfo<T>() where T : class, IModal
Returns
Type Parameters
TType 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
typeTypeType of the module.
servicesIServiceProviderThe 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
typeis 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
servicesIServiceProviderThe 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
TType of the module.
Exceptions
- ArgumentException
Thrown if this module has already been added.
- InvalidOperationException
Thrown when the
Tis 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
assemblyAssemblyAssembly the command modules are defined in.
servicesIServiceProviderThe 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
deleteMissingboolIf false, this operation will not delete the commands that are missing from InteractionService.
modulesModuleInfo[]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
guildIGuildThe target guild.
deleteMissingboolIf false, this operation will not delete the commands that are missing from InteractionService.
modulesModuleInfo[]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
guildIdulongThe target guild ID.
deleteMissingboolIf false, this operation will not delete the commands that are missing from InteractionService.
modulesModuleInfo[]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
typeTypePrimary target Type of the TypeConverter.
converterTypeConverterThe TypeConverter instance.
AddTypeConverter<T>(TypeConverter)
Add a concrete type TypeConverter.
public void AddTypeConverter<T>(TypeConverter converter)
Parameters
converterTypeConverterThe TypeConverter instance.
Type Parameters
TPrimary target Type of the TypeConverter.
AddTypeReader(Type, TypeReader)
Add a concrete type TypeReader.
public void AddTypeReader(Type type, TypeReader reader)
Parameters
typeTypePrimary target Type of the TypeReader.
readerTypeReaderThe TypeReader instance.
AddTypeReader<T>(TypeReader)
Add a concrete type TypeReader.
public void AddTypeReader<T>(TypeReader reader)
Parameters
readerTypeReaderThe TypeReader instance.
Type Parameters
TPrimary 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
namestringName of the module.
servicesIServiceProviderThe IServiceProvider for your dependency injection solution if using one; otherwise, pass null.
buildFuncAction<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
contextIInteractionContextName context of the command.
servicesIServiceProviderThe 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
formatstringA composite format string.
servicesIServiceProviderServices that will be passed on to the TypeReaders.
argsobject[]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
TModuleDeclaring 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
TModuleDeclaring 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
TModuleType 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
TModuleDeclaring 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
commandContextCommandInfoThe Context Command.
guildIGuildTarget guild.
permissionsApplicationCommandPermission[]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
commandContextCommandInfoThe Context Command.
guildIdulongTarget guild ID.
permissionsApplicationCommandPermission[]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
moduleModuleInfoModule representing the top level Slash Command.
guildIGuildTarget guild.
permissionsApplicationCommandPermission[]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
moduleModuleInfoModule representing the top level Slash Command.
guildIdulongTarget guild ID.
permissionsApplicationCommandPermission[]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
commandSlashCommandInfoThe Slash Command.
guildIGuildTarget guild.
permissionsApplicationCommandPermission[]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
commandSlashCommandInfoThe Slash Command.
guildIdulongTarget guild ID.
permissionsApplicationCommandPermission[]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
deleteMissingboolIf 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
guildIdulongId of the target guild.
deleteMissingboolIf 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
moduleModuleInfoThe 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
moduleis 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
TThe 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
guildIGuildThe target guild.
modulesModuleInfo[]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
guildIdulongThe target guild ID.
modulesModuleInfo[]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
autocompleteInteractionIAutocompleteInteractionInteraction 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
componentInteractionIComponentInteractionInteraction 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
messageCommandInteractionIMessageCommandInteractionInteraction 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
slashCommandInteractionISlashCommandInteractionInteraction 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
userCommandInteractionIUserCommandInteractionInteraction 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
objTObject to be serialized.
servicesIServiceProviderServices 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
TType 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
typeTypeThe type to remove the reader from.
readerTypeTypeThe 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
readerTypeTypeThe removed readers type.
Returns
Type Parameters
TThe 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
typeTypeThe type to remove the reader from.
readerTypeReaderThe 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
readerTypeReaderThe reader if the resulting remove operation was successful.
Returns
Type Parameters
TThe 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