Search Results for

    Show / Hide Table of Contents

    Class InteractionService

    Provides the framework for building and registering Discord Application Commands.

    Inheritance
    Object
    InteractionService
    Namespace: Discord.Interactions
    Assembly: Discord.Net.Interactions.dll
    Syntax
    public class InteractionService : IDisposable

    Constructors

    | Improve this Doc View Source

    InteractionService(DiscordRestClient, InteractionServiceConfig)

    Initialize a InteractionService with provided configurations.

    Declaration
    public InteractionService(DiscordRestClient discord, InteractionServiceConfig config = null)
    Parameters
    Type Name Description
    DiscordRestClient discord

    The discord client.

    InteractionServiceConfig config

    The configuration class.

    | Improve this Doc View Source

    InteractionService(BaseSocketClient, InteractionServiceConfig)

    Initialize a InteractionService with provided configurations.

    Declaration
    public InteractionService(BaseSocketClient discord, InteractionServiceConfig config = null)
    Parameters
    Type Name Description
    BaseSocketClient discord

    The discord client.

    InteractionServiceConfig config

    The configuration class.

    | Improve this Doc View Source

    InteractionService(DiscordShardedClient, InteractionServiceConfig)

    Initialize a InteractionService with provided configurations.

    Declaration
    public InteractionService(DiscordShardedClient discord, InteractionServiceConfig config = null)
    Parameters
    Type Name Description
    DiscordShardedClient discord

    The discord client.

    InteractionServiceConfig config

    The configuration class.

    | Improve this Doc View Source

    InteractionService(DiscordSocketClient, InteractionServiceConfig)

    Initialize a InteractionService with provided configurations.

    Declaration
    public InteractionService(DiscordSocketClient discord, InteractionServiceConfig config = null)
    Parameters
    Type Name Description
    DiscordSocketClient discord

    The discord client.

    InteractionServiceConfig config

    The configuration class.

    Properties

    | Improve this Doc View Source

    ComponentCommands

    Represents all Component Commands loaded within InteractionService.

    Declaration
    public IReadOnlyCollection<ComponentCommandInfo> ComponentCommands { get; }
    Property Value
    Type Description
    IReadOnlyCollection<ComponentCommandInfo>
    | Improve this Doc View Source

    ContextCommands

    Represents all Context Commands loaded within InteractionService.

    Declaration
    public IReadOnlyList<ContextCommandInfo> ContextCommands { get; }
    Property Value
    Type Description
    IReadOnlyList<ContextCommandInfo>
    | Improve this Doc View Source

    LocalizationManager

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

    Declaration
    public ILocalizationManager LocalizationManager { get; set; }
    Property Value
    Type Description
    ILocalizationManager
    | Improve this Doc View Source

    ModalCommands

    Represents all Modal Commands loaded within InteractionService.

    Declaration
    public IReadOnlyCollection<ModalCommandInfo> ModalCommands { get; }
    Property Value
    Type Description
    IReadOnlyCollection<ModalCommandInfo>
    | Improve this Doc View Source

    Modals

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

    Declaration
    public IReadOnlyCollection<ModalInfo> Modals { get; }
    Property Value
    Type Description
    IReadOnlyCollection<ModalInfo>
    | Improve this Doc View Source

    Modules

    Represents all modules loaded within InteractionService.

    Declaration
    public IReadOnlyList<ModuleInfo> Modules { get; }
    Property Value
    Type Description
    IReadOnlyList<ModuleInfo>
    | Improve this Doc View Source

    RestClient

    Rest client to be used to register application commands.

    Declaration
    public DiscordRestClient RestClient { get; }
    Property Value
    Type Description
    DiscordRestClient
    | Improve this Doc View Source

    SlashCommands

    Represents all Slash Commands loaded within InteractionService.

    Declaration
    public IReadOnlyList<SlashCommandInfo> SlashCommands { get; }
    Property Value
    Type Description
    IReadOnlyList<SlashCommandInfo>

    Methods

    | Improve this Doc View Source

    AddCommandsGloballyAsync(Boolean, IApplicationCommandInfo[])

    Register Application Commands from commands as global commands.

    Declaration
    public async Task<IReadOnlyCollection<RestGlobalCommand>> AddCommandsGloballyAsync(bool deleteMissing = false, params IApplicationCommandInfo[] commands)
    Parameters
    Type Name Description
    Boolean deleteMissing

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

    IApplicationCommandInfo[] commands

    Commands to be registered to Discord.

    Returns
    Type Description
    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, Boolean, ModuleInfo[]). Registering a commands without group names might cause the command traversal to fail.

    | Improve this Doc View Source

    AddCommandsToGuildAsync(IGuild, Boolean, ICommandInfo[])

    Register Application Commands from commands to a guild.

    Declaration
    public async Task<IReadOnlyCollection<RestGuildCommand>> AddCommandsToGuildAsync(IGuild guild, bool deleteMissing = false, params ICommandInfo[] commands)
    Parameters
    Type Name Description
    IGuild guild

    The target guild.

    Boolean deleteMissing

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

    ICommandInfo[] commands

    Commands to be registered to Discord.

    Returns
    Type Description
    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, Boolean, ModuleInfo[]). Registering a commands without group names might cause the command traversal to fail.

    | Improve this Doc View Source

    AddCommandsToGuildAsync(UInt64, Boolean, ICommandInfo[])

    Register Application Commands from commands to a guild.

    Declaration
    public async Task<IReadOnlyCollection<RestGuildCommand>> AddCommandsToGuildAsync(ulong guildId, bool deleteMissing = false, params ICommandInfo[] commands)
    Parameters
    Type Name Description
    UInt64 guildId

    The target guild ID.

    Boolean deleteMissing

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

    ICommandInfo[] commands

    Commands to be registered to Discord.

    Returns
    Type Description
    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(UInt64, Boolean, ModuleInfo[]). Registering a commands without group names might cause the command traversal to fail.

    | Improve this Doc View Source

    AddComponentTypeConverter(Type, ComponentTypeConverter)

    Add a concrete type ComponentTypeConverter.

    Declaration
    public void AddComponentTypeConverter(Type type, ComponentTypeConverter converter)
    Parameters
    Type Name Description
    Type type

    Primary target of the ComponentTypeConverter.

    ComponentTypeConverter converter

    The ComponentTypeConverter instance.

    | Improve this Doc View Source

    AddComponentTypeConverter<T>(ComponentTypeConverter)

    Add a concrete type ComponentTypeConverter.

    Declaration
    public void AddComponentTypeConverter<T>(ComponentTypeConverter converter)
    Parameters
    Type Name Description
    ComponentTypeConverter converter

    The ComponentTypeConverter instance.

    Type Parameters
    Name Description
    T

    Primary target of the ComponentTypeConverter.

    | Improve this Doc View Source

    AddGenericComponentTypeConverter(Type, Type)

    Add a generic type ComponentTypeConverter<T>.

    Declaration
    public void AddGenericComponentTypeConverter(Type targetType, Type converterType)
    Parameters
    Type Name Description
    Type targetType

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

    Type converterType

    Type of the ComponentTypeConverter<T>.

    | Improve this Doc View Source

    AddGenericComponentTypeConverter<T>(Type)

    Add a generic type ComponentTypeConverter<T>.

    Declaration
    public void AddGenericComponentTypeConverter<T>(Type converterType)
    Parameters
    Type Name Description
    Type converterType

    Type of the ComponentTypeConverter<T>.

    Type Parameters
    Name Description
    T

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

    | Improve this Doc View Source

    AddGenericTypeConverter(Type, Type)

    Add a generic type TypeConverter<T>.

    Declaration
    public void AddGenericTypeConverter(Type targetType, Type converterType)
    Parameters
    Type Name Description
    Type targetType

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

    Type converterType

    Type of the TypeConverter<T>.

    | Improve this Doc View Source

    AddGenericTypeConverter<T>(Type)

    Add a generic type TypeConverter<T>.

    Declaration
    public void AddGenericTypeConverter<T>(Type converterType)
    Parameters
    Type Name Description
    Type converterType

    Type of the TypeConverter<T>.

    Type Parameters
    Name Description
    T

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

    | Improve this Doc View Source

    AddGenericTypeReader(Type, Type)

    Add a generic type TypeReader<T>.

    Declaration
    public void AddGenericTypeReader(Type targetType, Type readerType)
    Parameters
    Type Name Description
    Type targetType

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

    Type readerType

    Type of the TypeReader<T>.

    | Improve this Doc View Source

    AddGenericTypeReader<T>(Type)

    Add a generic type TypeReader<T>.

    Declaration
    public void AddGenericTypeReader<T>(Type readerType)
    Parameters
    Type Name Description
    Type readerType

    Type of the TypeReader<T>.

    Type Parameters
    Name Description
    T

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

    | Improve this Doc View Source

    AddModalInfo<T>()

    Loads and caches an ModalInfo for the provided IModal.

    Declaration
    public ModalInfo AddModalInfo<T>()
        where T : class, IModal
    Returns
    Type Description
    ModalInfo

    The built ModalInfo instance.

    Type Parameters
    Name Description
    T

    Type of IModal to be loaded.

    | Improve this Doc View Source

    AddModuleAsync(Type, IServiceProvider)

    Add a command module from a .

    Declaration
    public async Task<ModuleInfo> AddModuleAsync(Type type, IServiceProvider services)
    Parameters
    Type Name Description
    Type type

    Type of the module.

    IServiceProvider services

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

    Returns
    Type Description
    Task<ModuleInfo>

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

    | Improve this Doc View Source

    AddModuleAsync<T>(IServiceProvider)

    Add a command module from a .

    Declaration
    public Task<ModuleInfo> AddModuleAsync<T>(IServiceProvider services)
        where T : class
    Parameters
    Type Name Description
    IServiceProvider services

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

    Returns
    Type Description
    Task<ModuleInfo>

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

    Type Parameters
    Name Description
    T

    Type of the module.

    | Improve this Doc View Source

    AddModulesAsync(Assembly, IServiceProvider)

    Discover and load command modules from an .

    Declaration
    public async Task<IEnumerable<ModuleInfo>> AddModulesAsync(Assembly assembly, IServiceProvider services)
    Parameters
    Type Name Description
    Assembly assembly

    the command modules are defined in.

    IServiceProvider services

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

    Returns
    Type Description
    Task<IEnumerable<ModuleInfo>>

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

    | Improve this Doc View Source

    AddModulesGloballyAsync(Boolean, ModuleInfo[])

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

    Declaration
    public async Task<IReadOnlyCollection<RestGlobalCommand>> AddModulesGloballyAsync(bool deleteMissing = false, params ModuleInfo[] modules)
    Parameters
    Type Name Description
    Boolean deleteMissing

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

    ModuleInfo[] modules

    Modules to be registered to Discord.

    Returns
    Type Description
    Task<IReadOnlyCollection<RestGlobalCommand>>

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

    | Improve this Doc View Source

    AddModulesToGuildAsync(IGuild, Boolean, ModuleInfo[])

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

    Declaration
    public async Task<IReadOnlyCollection<RestGuildCommand>> AddModulesToGuildAsync(IGuild guild, bool deleteMissing = false, params ModuleInfo[] modules)
    Parameters
    Type Name Description
    IGuild guild

    The target guild.

    Boolean deleteMissing

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

    ModuleInfo[] modules

    Modules to be registered to Discord.

    Returns
    Type Description
    Task<IReadOnlyCollection<RestGuildCommand>>

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

    | Improve this Doc View Source

    AddModulesToGuildAsync(UInt64, Boolean, ModuleInfo[])

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

    Declaration
    public async Task<IReadOnlyCollection<RestGuildCommand>> AddModulesToGuildAsync(ulong guildId, bool deleteMissing = false, params ModuleInfo[] modules)
    Parameters
    Type Name Description
    UInt64 guildId

    The target guild ID.

    Boolean deleteMissing

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

    ModuleInfo[] modules

    Modules to be registered to Discord.

    Returns
    Type Description
    Task<IReadOnlyCollection<RestGuildCommand>>

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

    | Improve this Doc View Source

    AddTypeConverter(Type, TypeConverter)

    Add a concrete type TypeConverter.

    Declaration
    public void AddTypeConverter(Type type, TypeConverter converter)
    Parameters
    Type Name Description
    Type type

    Primary target of the TypeConverter.

    TypeConverter converter

    The TypeConverter instance.

    | Improve this Doc View Source

    AddTypeConverter<T>(TypeConverter)

    Add a concrete type TypeConverter.

    Declaration
    public void AddTypeConverter<T>(TypeConverter converter)
    Parameters
    Type Name Description
    TypeConverter converter

    The TypeConverter instance.

    Type Parameters
    Name Description
    T

    Primary target of the TypeConverter.

    | Improve this Doc View Source

    AddTypeReader(Type, TypeReader)

    Add a concrete type TypeReader.

    Declaration
    public void AddTypeReader(Type type, TypeReader reader)
    Parameters
    Type Name Description
    Type type

    Primary target of the TypeReader.

    TypeReader reader

    The TypeReader instance.

    | Improve this Doc View Source

    AddTypeReader<T>(TypeReader)

    Add a concrete type TypeReader.

    Declaration
    public void AddTypeReader<T>(TypeReader reader)
    Parameters
    Type Name Description
    TypeReader reader

    The TypeReader instance.

    Type Parameters
    Name Description
    T

    Primary target of the TypeReader.

    | Improve this Doc View Source

    CreateModuleAsync(String, IServiceProvider, Action<ModuleBuilder>)

    Create and loads a ModuleInfo using a builder factory.

    Declaration
    public async Task<ModuleInfo> CreateModuleAsync(string name, IServiceProvider services, Action<ModuleBuilder> buildFunc)
    Parameters
    Type Name Description
    String name

    Name of the module.

    IServiceProvider services

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

    Action<ModuleBuilder> buildFunc

    Module builder factory.

    Returns
    Type Description
    Task<ModuleInfo>

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

    | Improve this Doc View Source

    Dispose()

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    ExecuteCommandAsync(IInteractionContext, IServiceProvider)

    Execute a Command from a given IInteractionContext.

    Declaration
    public async Task<IResult> ExecuteCommandAsync(IInteractionContext context, IServiceProvider services)
    Parameters
    Type Name Description
    IInteractionContext context

    Name context of the command.

    IServiceProvider services

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

    Returns
    Type Description
    Task<IResult>

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

    | Improve this Doc View Source

    GenerateCustomIdStringAsync(String, IServiceProvider, Object[])

    Serialize and format multiple objects into a Custom Id string.

    Declaration
    public async Task<string> GenerateCustomIdStringAsync(string format, IServiceProvider services, params object[] args)
    Parameters
    Type Name Description
    String format

    A composite format string.

    IServiceProvider services

    Services that will be passed on to the TypeReaders.

    Object[] args

    Objects to be serialized.

    Returns
    Type Description
    Task<String>

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

    | Improve this Doc View Source

    GetComponentCommandInfo<TModule>(String)

    Gets a ComponentCommandInfo.

    Declaration
    public ComponentCommandInfo GetComponentCommandInfo<TModule>(string methodName)
        where TModule : class
    Parameters
    Type Name Description
    String methodName

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

    Returns
    Type Description
    ComponentCommandInfo

    ComponentCommandInfo instance for this command.

    Type Parameters
    Name Description
    TModule

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

    | Improve this Doc View Source

    GetContextCommandInfo<TModule>(String)

    Gets a ContextCommandInfo.

    Declaration
    public ContextCommandInfo GetContextCommandInfo<TModule>(string methodName)
        where TModule : class
    Parameters
    Type Name Description
    String methodName

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

    Returns
    Type Description
    ContextCommandInfo

    ContextCommandInfo instance for this command.

    Type Parameters
    Name Description
    TModule

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

    | Improve this Doc View Source

    GetModuleInfo<TModule>()

    Gets a built ModuleInfo.

    Declaration
    public ModuleInfo GetModuleInfo<TModule>()
        where TModule : class
    Returns
    Type Description
    ModuleInfo

    ModuleInfo instance for this module.

    Type Parameters
    Name Description
    TModule

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

    | Improve this Doc View Source

    GetSlashCommandInfo<TModule>(String)

    Gets a SlashCommandInfo.

    Declaration
    public SlashCommandInfo GetSlashCommandInfo<TModule>(string methodName)
        where TModule : class
    Parameters
    Type Name Description
    String methodName

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

    Returns
    Type Description
    SlashCommandInfo

    SlashCommandInfo instance for this command.

    Type Parameters
    Name Description
    TModule

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

    | Improve this Doc View Source

    ModifyContextCommandPermissionsAsync(ContextCommandInfo, IGuild, ApplicationCommandPermission[])

    Modify the command permissions of the matching Discord Slash Command.

    Declaration
    public async Task<GuildApplicationCommandPermission> ModifyContextCommandPermissionsAsync(ContextCommandInfo command, IGuild guild, params ApplicationCommandPermission[] permissions)
    Parameters
    Type Name Description
    ContextCommandInfo command

    The Context Command.

    IGuild guild

    Target guild.

    ApplicationCommandPermission[] permissions

    New permission values.

    Returns
    Type Description
    Task<GuildApplicationCommandPermission>

    The active command permissions after the modification.

    | Improve this Doc View Source

    ModifyContextCommandPermissionsAsync(ContextCommandInfo, UInt64, ApplicationCommandPermission[])

    Modify the command permissions of the matching Discord Slash Command.

    Declaration
    public async Task<GuildApplicationCommandPermission> ModifyContextCommandPermissionsAsync(ContextCommandInfo command, ulong guildId, params ApplicationCommandPermission[] permissions)
    Parameters
    Type Name Description
    ContextCommandInfo command

    The Context Command.

    UInt64 guildId

    Target guild ID.

    ApplicationCommandPermission[] permissions

    New permission values.

    Returns
    Type Description
    Task<GuildApplicationCommandPermission>

    The active command permissions after the modification.

    | Improve this Doc View Source

    ModifySlashCommandPermissionsAsync(ModuleInfo, IGuild, ApplicationCommandPermission[])

    Modify the command permissions of the matching Discord Slash Command.

    Declaration
    public async Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(ModuleInfo module, IGuild guild, params ApplicationCommandPermission[] permissions)
    Parameters
    Type Name Description
    ModuleInfo module

    Module representing the top level Slash Command.

    IGuild guild

    Target guild.

    ApplicationCommandPermission[] permissions

    New permission values.

    Returns
    Type Description
    Task<GuildApplicationCommandPermission>

    The active command permissions after the modification.

    | Improve this Doc View Source

    ModifySlashCommandPermissionsAsync(ModuleInfo, UInt64, ApplicationCommandPermission[])

    Modify the command permissions of the matching Discord Slash Command.

    Declaration
    public async Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(ModuleInfo module, ulong guildId, params ApplicationCommandPermission[] permissions)
    Parameters
    Type Name Description
    ModuleInfo module

    Module representing the top level Slash Command.

    UInt64 guildId

    Target guild ID.

    ApplicationCommandPermission[] permissions

    New permission values.

    Returns
    Type Description
    Task<GuildApplicationCommandPermission>

    The active command permissions after the modification.

    | Improve this Doc View Source

    ModifySlashCommandPermissionsAsync(SlashCommandInfo, IGuild, ApplicationCommandPermission[])

    Modify the command permissions of the matching Discord Slash Command.

    Declaration
    public async Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(SlashCommandInfo command, IGuild guild, params ApplicationCommandPermission[] permissions)
    Parameters
    Type Name Description
    SlashCommandInfo command

    The Slash Command.

    IGuild guild

    Target guild.

    ApplicationCommandPermission[] permissions

    New permission values.

    Returns
    Type Description
    Task<GuildApplicationCommandPermission>

    The active command permissions after the modification.

    | Improve this Doc View Source

    ModifySlashCommandPermissionsAsync(SlashCommandInfo, UInt64, ApplicationCommandPermission[])

    Modify the command permissions of the matching Discord Slash Command.

    Declaration
    public async Task<GuildApplicationCommandPermission> ModifySlashCommandPermissionsAsync(SlashCommandInfo command, ulong guildId, params ApplicationCommandPermission[] permissions)
    Parameters
    Type Name Description
    SlashCommandInfo command

    The Slash Command.

    UInt64 guildId

    Target guild ID.

    ApplicationCommandPermission[] permissions

    New permission values.

    Returns
    Type Description
    Task<GuildApplicationCommandPermission>

    The active command permissions after the modification.

    | Improve this Doc View Source

    RegisterCommandsGloballyAsync(Boolean)

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

    Declaration
    public async Task<IReadOnlyCollection<RestGlobalCommand>> RegisterCommandsGloballyAsync(bool deleteMissing = true)
    Parameters
    Type Name Description
    Boolean deleteMissing

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

    Returns
    Type Description
    Task<IReadOnlyCollection<RestGlobalCommand>>

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

    | Improve this Doc View Source

    RegisterCommandsToGuildAsync(UInt64, Boolean)

    Register Application Commands from ContextCommands and SlashCommands to a guild.

    Declaration
    public async Task<IReadOnlyCollection<RestGuildCommand>> RegisterCommandsToGuildAsync(ulong guildId, bool deleteMissing = true)
    Parameters
    Type Name Description
    UInt64 guildId

    Id of the target guild.

    Boolean deleteMissing

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

    Returns
    Type Description
    Task<IReadOnlyCollection<RestGuildCommand>>

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

    | Improve this Doc View Source

    RemoveModuleAsync(ModuleInfo)

    Remove a command module.

    Declaration
    public async Task<bool> RemoveModuleAsync(ModuleInfo module)
    Parameters
    Type Name Description
    ModuleInfo module

    The ModuleInfo to be removed from the service.

    Returns
    Type Description
    Task<Boolean>

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

    | Improve this Doc View Source

    RemoveModuleAsync(Type)

    Remove a command module.

    Declaration
    public async Task<bool> RemoveModuleAsync(Type type)
    Parameters
    Type Name Description
    Type type

    The of the module.

    Returns
    Type Description
    Task<Boolean>

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

    | Improve this Doc View Source

    RemoveModuleAsync<T>()

    Remove a command module.

    Declaration
    public Task<bool> RemoveModuleAsync<T>()
    Returns
    Type Description
    Task<Boolean>

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

    Type Parameters
    Name Description
    T

    The of the module.

    | Improve this Doc View Source

    SearchAutocompleteCommand(IAutocompleteInteraction)

    Search the registered slash commands using a IAutocompleteInteraction.

    Declaration
    public SearchResult<AutocompleteCommandInfo> SearchAutocompleteCommand(IAutocompleteInteraction autocompleteInteraction)
    Parameters
    Type Name Description
    IAutocompleteInteraction autocompleteInteraction

    Interaction entity to perform the search with.

    Returns
    Type Description
    SearchResult<AutocompleteCommandInfo>

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

    | Improve this Doc View Source

    SearchComponentCommand(IComponentInteraction)

    Search the registered slash commands using a IComponentInteraction.

    Declaration
    public SearchResult<ComponentCommandInfo> SearchComponentCommand(IComponentInteraction componentInteraction)
    Parameters
    Type Name Description
    IComponentInteraction componentInteraction

    Interaction entity to perform the search with.

    Returns
    Type Description
    SearchResult<ComponentCommandInfo>

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

    | Improve this Doc View Source

    SearchMessageCommand(IMessageCommandInteraction)

    Search the registered slash commands using a IMessageCommandInteraction.

    Declaration
    public SearchResult<ContextCommandInfo> SearchMessageCommand(IMessageCommandInteraction messageCommandInteraction)
    Parameters
    Type Name Description
    IMessageCommandInteraction messageCommandInteraction

    Interaction entity to perform the search with.

    Returns
    Type Description
    SearchResult<ContextCommandInfo>

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

    | Improve this Doc View Source

    SearchSlashCommand(ISlashCommandInteraction)

    Search the registered slash commands using a ISlashCommandInteraction.

    Declaration
    public SearchResult<SlashCommandInfo> SearchSlashCommand(ISlashCommandInteraction slashCommandInteraction)
    Parameters
    Type Name Description
    ISlashCommandInteraction slashCommandInteraction

    Interaction entity to perform the search with.

    Returns
    Type Description
    SearchResult<SlashCommandInfo>

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

    | Improve this Doc View Source

    SearchUserCommand(IUserCommandInteraction)

    Search the registered slash commands using a IUserCommandInteraction.

    Declaration
    public SearchResult<ContextCommandInfo> SearchUserCommand(IUserCommandInteraction userCommandInteraction)
    Parameters
    Type Name Description
    IUserCommandInteraction userCommandInteraction

    Interaction entity to perform the search with.

    Returns
    Type Description
    SearchResult<ContextCommandInfo>

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

    | Improve this Doc View Source

    SerializeValueAsync<T>(T, IServiceProvider)

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

    Declaration
    public Task<string> SerializeValueAsync<T>(T obj, IServiceProvider services)
    Parameters
    Type Name Description
    T obj

    Object to be serialized.

    IServiceProvider services

    Services that will be passed on to the TypeReader.

    Returns
    Type Description
    Task<String>

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

    Type Parameters
    Name Description
    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.

    | Improve this Doc View Source

    TryRemoveGenericTypeReader(Type, out Type)

    Removes a generic type reader from the given type.

    Declaration
    public bool TryRemoveGenericTypeReader(Type type, out Type readerType)
    Parameters
    Type Name Description
    Type type

    The type to remove the reader from.

    Type readerType

    The readers type if the remove operation was successful.

    Returns
    Type Description
    Boolean

    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.

    | Improve this Doc View Source

    TryRemoveGenericTypeReader<T>(out Type)

    Removes a generic type reader from the type T.

    Declaration
    public bool TryRemoveGenericTypeReader<T>(out Type readerType)
    Parameters
    Type Name Description
    Type readerType

    The removed readers type.

    Returns
    Type Description
    Boolean

    true if the remove operation was successful; otherwise false.

    Type Parameters
    Name Description
    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.

    | Improve this Doc View Source

    TryRemoveTypeReader(Type, out TypeReader)

    Removes a type reader for the given type.

    Declaration
    public bool TryRemoveTypeReader(Type type, out TypeReader reader)
    Parameters
    Type Name Description
    Type type

    The type to remove the reader from.

    TypeReader reader

    The reader if the resulting remove operation was successful.

    Returns
    Type Description
    Boolean

    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.

    | Improve this Doc View Source

    TryRemoveTypeReader<T>(out TypeReader)

    Removes a type reader for the type T.

    Declaration
    public bool TryRemoveTypeReader<T>(out TypeReader reader)
    Parameters
    Type Name Description
    TypeReader reader

    The reader if the resulting remove operation was successful.

    Returns
    Type Description
    Boolean

    true if the remove operation was successful; otherwise false.

    Type Parameters
    Name Description
    T

    The type to remove the readers from.

    Events

    | Improve this Doc View Source

    AutocompleteCommandExecuted

    Occurs when a Autocomplete command is executed.

    Declaration
    public event Func<AutocompleteCommandInfo, IInteractionContext, IResult, Task> AutocompleteCommandExecuted
    Event Type
    Type Description
    Func<AutocompleteCommandInfo, IInteractionContext, IResult, Task>
    | Improve this Doc View Source

    AutocompleteHandlerExecuted

    Occurs when a AutocompleteHandler is executed.

    Declaration
    public event Func<IAutocompleteHandler, IInteractionContext, IResult, Task> AutocompleteHandlerExecuted
    Event Type
    Type Description
    Func<IAutocompleteHandler, IInteractionContext, IResult, Task>
    | Improve this Doc View Source

    ComponentCommandExecuted

    Occurs when a Message Component command is executed.

    Declaration
    public event Func<ComponentCommandInfo, IInteractionContext, IResult, Task> ComponentCommandExecuted
    Event Type
    Type Description
    Func<ComponentCommandInfo, IInteractionContext, IResult, Task>
    | Improve this Doc View Source

    ContextCommandExecuted

    Occurs when a Context Command is executed.

    Declaration
    public event Func<ContextCommandInfo, IInteractionContext, IResult, Task> ContextCommandExecuted
    Event Type
    Type Description
    Func<ContextCommandInfo, IInteractionContext, IResult, Task>
    | Improve this Doc View Source

    InteractionExecuted

    Occurs when any type of interaction is executed.

    Declaration
    public event Func<ICommandInfo, IInteractionContext, IResult, Task> InteractionExecuted
    Event Type
    Type Description
    Func<ICommandInfo, IInteractionContext, IResult, Task>
    | Improve this Doc View Source

    Log

    Occurs when a Slash Command related information is recieved.

    Declaration
    public event Func<LogMessage, Task> Log
    Event Type
    Type Description
    Func<LogMessage, Task>
    | Improve this Doc View Source

    ModalCommandExecuted

    Occurs when a Modal command is executed.

    Declaration
    public event Func<ModalCommandInfo, IInteractionContext, IResult, Task> ModalCommandExecuted
    Event Type
    Type Description
    Func<ModalCommandInfo, IInteractionContext, IResult, Task>
    | Improve this Doc View Source

    SlashCommandExecuted

    Occurs when a Slash Command is executed.

    Declaration
    public event Func<SlashCommandInfo, IInteractionContext, IResult, Task> SlashCommandExecuted
    Event Type
    Type Description
    Func<SlashCommandInfo, IInteractionContext, IResult, Task>

    Theme

    • Improve this Doc
    • View Source
    In This Article
    Back to top Discord.Net (c) 2015-2022 3.9.0