Search Results for

    Show / Hide Table of Contents

    Interface IDiscordRestGuild

    Contains all the API calls mentioned in the guild object documentation. Docs: https://discord.com/developers/docs/resources/guild

    Namespace: Color_Chan.Discord.Core.Common.API.Rest
    Assembly: Color-Chan.Discord.Core.dll
    Syntax
    public interface IDiscordRestGuild

    Methods

    | Improve this Doc View Source

    AddGuildMemberAsync(UInt64, UInt64, DiscordAddGuildMember, CancellationToken)

    Adds a user to the guild, provided you have a valid oauth2 access token for the user with the guilds.join scope.

    Declaration
    Task<Result<IDiscordGuildMember>> AddGuildMemberAsync(ulong guildId, ulong userId, DiscordAddGuildMember addGuildMember, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.UInt64 userId

    The user id of the new member.

    DiscordAddGuildMember addGuildMember

    The DiscordAddGuildMember containing the body.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordGuildMember>>

    A Result<T> of IDiscordGuildMember. IDiscordGuildMember will be null if the user was already in the server.

    | Improve this Doc View Source

    AddGuildMemberRoleAsync(UInt64, UInt64, UInt64, String, CancellationToken)

    Add a role to a guild member.

    Declaration
    Task<Result> AddGuildMemberRoleAsync(ulong guildId, ulong userId, ulong roleId, string auditLogReason = null, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.UInt64 userId

    The user id.

    System.UInt64 roleId

    The role id.

    System.String auditLogReason

    The reason for this action. This will be shown in the audit logs.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result>

    A Result with the request results.

    | Improve this Doc View Source

    CreateGuildAsync(DiscordCreateGuild, CancellationToken)

    Create a new guild.

    Declaration
    Task<Result<IDiscordGuild>> CreateGuildAsync(DiscordCreateGuild createGuild, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    DiscordCreateGuild createGuild

    The DiscordCreateGuild params that will be used to create the guild.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordGuild>>

    A Result<T> of IDiscordGuild with the request results.

    | Improve this Doc View Source

    CreateGuildRoleAsync(UInt64, DiscordCreateGuildRole, String, CancellationToken)

    Creates a new discord guild role.

    Declaration
    Task<Result<IDiscordGuildRole>> CreateGuildRoleAsync(ulong guildId, DiscordCreateGuildRole role, string auditLogReason = null, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    DiscordCreateGuildRole role

    The DiscordCreateGuildRole containing the new role data.

    System.String auditLogReason

    The reason for this action. This will be shown in the audit logs.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordGuildRole>>

    A Result<T> of IDiscordGuildRole with the request results.

    | Improve this Doc View Source

    DeleteGuildAsync(UInt64, CancellationToken)

    Deletes a guild.

    Declaration
    Task<Result> DeleteGuildAsync(ulong guildId, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result>

    A Result with the request results.

    | Improve this Doc View Source

    DeleteGuildRoleAsync(UInt64, UInt64, String, CancellationToken)

    Deletes a discord guild role.

    Declaration
    Task<Result> DeleteGuildRoleAsync(ulong guildId, ulong roleId, string auditLogReason = null, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.UInt64 roleId

    The role id.

    System.String auditLogReason

    The reason for this action. This will be shown in the audit logs.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result>

    The Result with the request results.

    | Improve this Doc View Source

    GetGuildAsync(UInt64, Boolean, CancellationToken)

    Get a guild.

    Declaration
    Task<Result<IDiscordGuild>> GetGuildAsync(ulong guildId, bool withCounts = false, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The ID fo the guild.

    System.Boolean withCounts

    Whether or not the IDiscordGuild will contain approximate member and presence counts for the guild.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordGuild>>

    A Result<T> of IDiscordGuild with the request results.

    | Improve this Doc View Source

    GetGuildChannelsAsync(UInt64, CancellationToken)

    Get the channels of a guild.

    Declaration
    Task<Result<IReadOnlyList<IDiscordChannel>>> GetGuildChannelsAsync(ulong guildId, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<System.Collections.Generic.IReadOnlyList<IDiscordChannel>>>

    A Result<T> of IDiscordChannel with the request results.

    | Improve this Doc View Source

    GetGuildMemberAsync(UInt64, UInt64, CancellationToken)

    Get a guild member.

    Declaration
    Task<Result<IDiscordGuildMember>> GetGuildMemberAsync(ulong guildId, ulong userId, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.UInt64 userId

    The user id of the member.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordGuildMember>>

    A Result<T> of IDiscordGuildMember with the request results.

    | Improve this Doc View Source

    GetGuildPreviewAsync(UInt64, CancellationToken)

    Get a preview of a guild.

    Declaration
    Task<Result<IDiscordGuildPreview>> GetGuildPreviewAsync(ulong guildId, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    the guild id.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordGuildPreview>>

    A Result<T> of IDiscordGuildPreview with the request results.

    Remarks

    If the user is not in the guild, then the guild must be lurkable (it must be Discoverable or have a live public stage).

    | Improve this Doc View Source

    GetGuildRolesAsync(UInt64, CancellationToken)

    Get a list of IDiscordGuildRoles.

    Declaration
    Task<Result<IReadOnlyList<IDiscordGuildRole>>> GetGuildRolesAsync(ulong guildId, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<System.Collections.Generic.IReadOnlyList<IDiscordGuildRole>>>

    A Result<T> of System.Collections.Generic.IReadOnlyList<T> of IDiscordGuildRole with the request results.

    | Improve this Doc View Source

    ListGuildMembersAsync(UInt64, Int32, UInt64, CancellationToken)

    Get a list of guild members.

    Declaration
    Task<Result<IReadOnlyList<IDiscordGuildMember>>> ListGuildMembersAsync(ulong guildId, int limit = 1, ulong afterId = 0UL, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.Int32 limit

    max number of members to return (1-1000). Default is 1.

    System.UInt64 afterId

    the highest user id in the previous page. Default is 0.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<System.Collections.Generic.IReadOnlyList<IDiscordGuildMember>>>

    A Result<T> of System.Collections.Generic.IReadOnlyList<T> of IDiscordGuildMember with the request results.

    | Improve this Doc View Source

    ModifyCurrentUserNickAsync(UInt64, DiscordModifyCurrentUserNick, String, CancellationToken)

    Modify the current users nickname.

    Declaration
    Task<Result> ModifyCurrentUserNickAsync(ulong guildId, DiscordModifyCurrentUserNick modifyGuildMember, string auditLogReason = null, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    DiscordModifyCurrentUserNick modifyGuildMember

    The DiscordModifyCurrentUserNick data that will be used to modify the user.

    System.String auditLogReason

    The reason for this action. This will be shown in the audit logs.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result>

    A Result with the request results.

    | Improve this Doc View Source

    ModifyGuildAsync(UInt64, DiscordModifyGuild, String, CancellationToken)

    Modifies a guild.

    Declaration
    Task<Result<IDiscordGuild>> ModifyGuildAsync(ulong guildId, DiscordModifyGuild modifyGuild, string auditLogReason, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    DiscordModifyGuild modifyGuild

    The DiscordModifyGuild containing the data that will be used to modify the guild.

    System.String auditLogReason

    The reason for this action. This will be shown in the audit logs.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordGuild>>

    A Result<T> of IDiscordGuild with the request results.

    | Improve this Doc View Source

    ModifyGuildMemberAsync(UInt64, UInt64, DiscordModifyGuildMember, String, CancellationToken)

    Modify attributes of a guild member.

    Declaration
    Task<Result<IDiscordGuildMember>> ModifyGuildMemberAsync(ulong guildId, ulong userId, DiscordModifyGuildMember modifyGuildMember, string auditLogReason = null, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.UInt64 userId

    The user id of the guild member.

    DiscordModifyGuildMember modifyGuildMember

    The DiscordModifyGuildMember data that will be used to modify the user.

    System.String auditLogReason

    The reason for this action. This will be shown in the audit logs.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordGuildMember>>

    A Result<T> of IDiscordGuildMember with the request results.

    | Improve this Doc View Source

    ModifyGuildRoleAsync(UInt64, UInt64, DiscordModifyGuildRole, String, CancellationToken)

    Modify a guild role.

    Declaration
    Task<Result<IDiscordGuildRole>> ModifyGuildRoleAsync(ulong guildId, ulong roleId, DiscordModifyGuildRole role, string auditLogReason = null, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.UInt64 roleId

    The role id.

    DiscordModifyGuildRole role

    The DiscordModifyGuildRole containing the new role data.

    System.String auditLogReason

    The reason for this action. This will be shown in the audit logs.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordGuildRole>>

    A Result<T> of IDiscordGuildRole with the request results.

    | Improve this Doc View Source

    ModifyGuildRolePositionsAsync(UInt64, IEnumerable<DiscordModifyGuildRolePositions>, String, CancellationToken)

    Changes the positions of guild roles.

    Declaration
    Task<Result<IReadOnlyList<IDiscordGuildRole>>> ModifyGuildRolePositionsAsync(ulong guildId, IEnumerable<DiscordModifyGuildRolePositions> modifyGuildRoles, string auditLogReason = null, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.Collections.Generic.IEnumerable<DiscordModifyGuildRolePositions> modifyGuildRoles

    The DiscordModifyGuildRolePositions containing the new positions.

    System.String auditLogReason

    The reason for this action. This will be shown in the audit logs.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<System.Collections.Generic.IReadOnlyList<IDiscordGuildRole>>>

    A Result<T> of System.Collections.Generic.IReadOnlyList<T> of IDiscordGuildRole with the request results.

    | Improve this Doc View Source

    RemoveGuildMemberAsync(UInt64, UInt64, String, CancellationToken)

    Kick a member from a guild.

    Declaration
    Task<Result> RemoveGuildMemberAsync(ulong guildId, ulong userId, string auditLogReason = null, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.UInt64 userId

    The user id.

    System.String auditLogReason

    The reason for this action. This will be shown in the audit logs.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result>

    A Result with the request results.

    | Improve this Doc View Source

    RemoveGuildMemberRoleAsync(UInt64, UInt64, UInt64, String, CancellationToken)

    Removes a role from a guild member.

    Declaration
    Task<Result> RemoveGuildMemberRoleAsync(ulong guildId, ulong userId, ulong roleId, string auditLogReason = null, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.UInt64 userId

    The user id.

    System.UInt64 roleId

    The role id.

    System.String auditLogReason

    The reason for this action. This will be shown in the audit logs.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result>

    A Result with the request results.

    | Improve this Doc View Source

    SearchGuildMembersAsync(UInt64, String, Int32, CancellationToken)

    Get a list of guild member whose username or nickname starts with a provided string.

    Declaration
    Task<Result<IReadOnlyList<IDiscordGuildMember>>> SearchGuildMembersAsync(ulong guildId, string query, int limit = 1, CancellationToken ct = default(CancellationToken))
    Parameters
    Type Name Description
    System.UInt64 guildId

    The guild id.

    System.String query

    Query string to match username(s) and nickname(s) against.

    System.Int32 limit

    max number of members to return (1-1000). Default is 1.

    System.Threading.CancellationToken ct

    The System.Threading.CancellationToken.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<System.Collections.Generic.IReadOnlyList<IDiscordGuildMember>>>

    A Result<T> of System.Collections.Generic.IReadOnlyList<T> of IDiscordGuildMember with the request results.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX