Search Results for

    Show / Hide Table of Contents

    Class SocketGuild

    Represents a WebSocket-based guild object.

    Inheritance
    Object
    SocketEntity<UInt64>
    SocketGuild
    Implements
    IEntity<UInt64>
    IGuild
    IDeletable
    ISnowflakeEntity
    IEntity<UInt64>
    IDisposable
    Inherited Members
    SocketEntity<UInt64>.Id
    Namespace: Discord.WebSocket
    Assembly: Discord.Net.WebSocket.dll
    Syntax
    public class SocketGuild : SocketEntity<ulong>, IEntity<ulong>, IGuild, IDeletable, ISnowflakeEntity, IEntity<ulong>, IDisposable

    Properties

    | Improve this Doc View Source

    AFKChannel

    Gets the AFK voice channel in this guild.

    Declaration
    public SocketVoiceChannel AFKChannel { get; }
    Property Value
    Type Description
    SocketVoiceChannel

    A SocketVoiceChannel that the AFK users will be moved to after they have idled for too long; null if none is set.

    | Improve this Doc View Source

    AFKTimeout

    Declaration
    public int AFKTimeout { get; }
    Property Value
    Type Description
    Int32
    | Improve this Doc View Source

    ApplicationId

    Declaration
    public ulong? ApplicationId { get; }
    Property Value
    Type Description
    Nullable<UInt64>
    | Improve this Doc View Source

    AudioClient

    Gets the IAudioClient associated with this guild.

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

    BannerId

    Declaration
    public string BannerId { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    BannerUrl

    Declaration
    public string BannerUrl { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    CategoryChannels

    Gets a collection of all category channels in this guild.

    Declaration
    public IReadOnlyCollection<SocketCategoryChannel> CategoryChannels { get; }
    Property Value
    Type Description
    IReadOnlyCollection<SocketCategoryChannel>

    A read-only collection of category channels found within this guild.

    | Improve this Doc View Source

    Channels

    Gets a collection of all channels in this guild.

    Declaration
    public IReadOnlyCollection<SocketGuildChannel> Channels { get; }
    Property Value
    Type Description
    IReadOnlyCollection<SocketGuildChannel>

    A read-only collection of generic channels found within this guild.

    | Improve this Doc View Source

    CreatedAt

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

    CurrentUser

    Gets the current logged-in user.

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

    DefaultChannel

    Gets the default channel in this guild.

    Declaration
    public SocketTextChannel DefaultChannel { get; }
    Property Value
    Type Description
    SocketTextChannel

    A SocketTextChannel representing the first viewable channel that the user has access to.

    Remarks

    This property retrieves the first viewable text channel for this guild.

    warning

    This channel does not guarantee the user can send message to it, as it only looks for the first viewable text channel.

    | Improve this Doc View Source

    DefaultMessageNotifications

    Gets the default message notifications for users who haven't explicitly set their notification settings.

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

    Description

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

    DiscoverySplashId

    Declaration
    public string DiscoverySplashId { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    DiscoverySplashUrl

    Declaration
    public string DiscoverySplashUrl { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    DownloadedMemberCount

    Gets the number of members downloaded to the local guild cache.

    Declaration
    public int DownloadedMemberCount { get; }
    Property Value
    Type Description
    Int32
    | Improve this Doc View Source

    DownloaderPromise

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

    Emotes

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

    Events

    Gets a collection of all events within this guild.

    Declaration
    public IReadOnlyCollection<SocketGuildEvent> Events { get; }
    Property Value
    Type Description
    IReadOnlyCollection<SocketGuildEvent>

    A read-only collection of guild events found within this guild.

    Remarks

    This field is based off of caching alone, since there is no events returned on the guild model.

    | Improve this Doc View Source

    EveryoneRole

    Gets the built-in role containing all users in this guild.

    Declaration
    public SocketRole EveryoneRole { get; }
    Property Value
    Type Description
    SocketRole

    A role object that represents an @everyone role in this guild.

    | Improve this Doc View Source

    ExplicitContentFilter

    Gets the level of content filtering applied to user's content in a Guild.

    Declaration
    public ExplicitContentFilterLevel ExplicitContentFilter { get; }
    Property Value
    Type Description
    ExplicitContentFilterLevel

    The level of explicit content filtering.

    | Improve this Doc View Source

    Features

    Gets the features for this guild.

    Declaration
    public GuildFeatures Features { get; }
    Property Value
    Type Description
    GuildFeatures

    A flags enum containing all the features for the guild.

    | Improve this Doc View Source

    HasAllMembers

    Indicates whether the client has all the members downloaded to the local guild cache.

    Declaration
    public bool HasAllMembers { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    IconId

    Declaration
    public string IconId { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    IconUrl

    Declaration
    public string IconUrl { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    IsBoostProgressBarEnabled

    Declaration
    public bool IsBoostProgressBarEnabled { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    IsConnected

    Indicates whether the client is connected to this guild.

    Declaration
    public bool IsConnected { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    IsSynced

    Indicates whether the guild cache is synced to this guild.

    Declaration
    public bool IsSynced { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    IsWidgetEnabled

    Declaration
    public bool IsWidgetEnabled { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    MaxBitrate

    Declaration
    public int MaxBitrate { get; }
    Property Value
    Type Description
    Int32
    | Improve this Doc View Source

    MaxMembers

    Declaration
    public int? MaxMembers { get; }
    Property Value
    Type Description
    Nullable<Int32>
    | Improve this Doc View Source

    MaxPresences

    Declaration
    public int? MaxPresences { get; }
    Property Value
    Type Description
    Nullable<Int32>
    | Improve this Doc View Source

    MaxUploadLimit

    Declaration
    public ulong MaxUploadLimit { get; }
    Property Value
    Type Description
    UInt64
    | Improve this Doc View Source

    MaxVideoChannelUsers

    Declaration
    public int? MaxVideoChannelUsers { get; }
    Property Value
    Type Description
    Nullable<Int32>
    | Improve this Doc View Source

    MemberCount

    Gets the number of members.

    Declaration
    public int MemberCount { get; }
    Property Value
    Type Description
    Int32
    Remarks

    This property retrieves the number of members returned by Discord.

    tip

    Due to how this property is returned by Discord instead of relying on the WebSocket cache, the number here is the most accurate in terms of counting the number of users within this guild.

    Use this instead of enumerating the count of the Users collection, as you may see discrepancy between that and this property.

    | Improve this Doc View Source

    MfaLevel

    Gets the level of Multi-Factor Authentication requirements a user must fulfill before being allowed to perform administrative actions in this guild.

    Declaration
    public MfaLevel MfaLevel { get; }
    Property Value
    Type Description
    MfaLevel

    The level of MFA requirement.

    | Improve this Doc View Source

    Name

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    NsfwLevel

    Gets the NSFW level of this guild.

    Declaration
    public NsfwLevel NsfwLevel { get; }
    Property Value
    Type Description
    NsfwLevel

    The NSFW level of this guild.

    | Improve this Doc View Source

    Owner

    Gets the user that owns this guild.

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

    OwnerId

    Declaration
    public ulong OwnerId { get; }
    Property Value
    Type Description
    UInt64
    | Improve this Doc View Source

    PreferredCulture

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

    PreferredLocale

    Declaration
    public string PreferredLocale { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    PremiumSubscriptionCount

    Declaration
    public int PremiumSubscriptionCount { get; }
    Property Value
    Type Description
    Int32
    | Improve this Doc View Source

    PremiumTier

    Gets the tier of guild boosting in this guild.

    Declaration
    public PremiumTier PremiumTier { get; }
    Property Value
    Type Description
    PremiumTier

    The tier of guild boosting in this guild.

    | Improve this Doc View Source

    PublicUpdatesChannel

    Gets the channel where admins and moderators of Community guilds receive notices from Discord.

    Declaration
    public SocketTextChannel PublicUpdatesChannel { get; }
    Property Value
    Type Description
    SocketTextChannel

    A text channel where admins and moderators of Community guilds receive notices from Discord; null if none is set.

    | Improve this Doc View Source

    Roles

    Gets a collection of all roles in this guild.

    Declaration
    public IReadOnlyCollection<SocketRole> Roles { get; }
    Property Value
    Type Description
    IReadOnlyCollection<SocketRole>

    A read-only collection of roles found within this guild.

    | Improve this Doc View Source

    RulesChannel

    Gets the channel with the guild rules.

    Declaration
    public SocketTextChannel RulesChannel { get; }
    Property Value
    Type Description
    SocketTextChannel

    A text channel with the guild rules; null if none is set.

    | Improve this Doc View Source

    SplashId

    Declaration
    public string SplashId { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    SplashUrl

    Declaration
    public string SplashUrl { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    StageChannels

    Gets a collection of all stage channels in this guild.

    Declaration
    public IReadOnlyCollection<SocketStageChannel> StageChannels { get; }
    Property Value
    Type Description
    IReadOnlyCollection<SocketStageChannel>

    A read-only collection of stage channels found within this guild.

    | Improve this Doc View Source

    Stickers

    Gets a collection of all custom stickers for this guild.

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

    SyncPromise

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

    SystemChannel

    Gets the system channel where randomized welcome messages are sent in this guild.

    Declaration
    public SocketTextChannel SystemChannel { get; }
    Property Value
    Type Description
    SocketTextChannel

    A text channel where randomized welcome messages will be sent to; null if none is set.

    | Improve this Doc View Source

    SystemChannelFlags

    Gets the flags for the types of system channel messages that are disabled.

    Declaration
    public SystemChannelMessageDeny SystemChannelFlags { get; }
    Property Value
    Type Description
    SystemChannelMessageDeny

    The flags for the types of system channel messages that are disabled.

    | Improve this Doc View Source

    TextChannels

    Gets a collection of all text channels in this guild.

    Declaration
    public IReadOnlyCollection<SocketTextChannel> TextChannels { get; }
    Property Value
    Type Description
    IReadOnlyCollection<SocketTextChannel>

    A read-only collection of message channels found within this guild.

    | Improve this Doc View Source

    ThreadChannels

    Gets a collection of all thread channels in this guild.

    Declaration
    public IReadOnlyCollection<SocketThreadChannel> ThreadChannels { get; }
    Property Value
    Type Description
    IReadOnlyCollection<SocketThreadChannel>

    A read-only collection of thread channels found within this guild.

    | Improve this Doc View Source

    Users

    Gets a collection of users in this guild.

    Declaration
    public IReadOnlyCollection<SocketGuildUser> Users { get; }
    Property Value
    Type Description
    IReadOnlyCollection<SocketGuildUser>

    A collection of guild users found within this guild.

    Remarks

    This property retrieves all users found within this guild.

    warning

    This property may not always return all the members for large guilds (i.e. guilds containing 100+ users). If you are simply looking to get the number of users present in this guild, consider using MemberCount instead.

    Otherwise, you may need to enable AlwaysDownloadUsers to fetch the full user list upon startup, or use DownloadUsersAsync() to manually download the users.

    | Improve this Doc View Source

    VanityURLCode

    Declaration
    public string VanityURLCode { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    VerificationLevel

    Gets the level of requirements a user must fulfill before being allowed to post messages in this guild.

    Declaration
    public VerificationLevel VerificationLevel { get; }
    Property Value
    Type Description
    VerificationLevel

    The level of requirements.

    | Improve this Doc View Source

    VoiceChannels

    Gets a collection of all voice channels in this guild.

    Declaration
    public IReadOnlyCollection<SocketVoiceChannel> VoiceChannels { get; }
    Property Value
    Type Description
    IReadOnlyCollection<SocketVoiceChannel>

    A read-only collection of voice channels found within this guild.

    | Improve this Doc View Source

    VoiceRegionId

    Declaration
    public string VoiceRegionId { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    WidgetChannel

    Gets the widget channel (i.e. the channel set in the guild's widget settings) in this guild.

    Declaration
    public SocketGuildChannel WidgetChannel { get; }
    Property Value
    Type Description
    SocketGuildChannel

    A channel set within the server's widget settings; null if none is set.

    Methods

    | Improve this Doc View Source

    AddBanAsync(IUser, Int32, String, RequestOptions)

    Declaration
    public Task AddBanAsync(IUser user, int pruneDays = 0, string reason = null, RequestOptions options = null)
    Parameters
    Type Name Description
    IUser user
    Int32 pruneDays
    String reason
    RequestOptions options
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    AddBanAsync(UInt64, Int32, String, RequestOptions)

    Declaration
    public Task AddBanAsync(ulong userId, int pruneDays = 0, string reason = null, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 userId
    Int32 pruneDays
    String reason
    RequestOptions options
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    AddGuildUserAsync(UInt64, String, Action<AddGuildUserProperties>, RequestOptions)

    Declaration
    public Task<RestGuildUser> AddGuildUserAsync(ulong id, string accessToken, Action<AddGuildUserProperties> func = null, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 id
    String accessToken
    Action<AddGuildUserProperties> func
    RequestOptions options
    Returns
    Type Description
    Task<RestGuildUser>
    | Improve this Doc View Source

    BulkOverwriteApplicationCommandAsync(ApplicationCommandProperties[], RequestOptions)

    Overwrites the application commands within this guild.

    Declaration
    public async Task<IReadOnlyCollection<SocketApplicationCommand>> BulkOverwriteApplicationCommandAsync(ApplicationCommandProperties[] properties, RequestOptions options = null)
    Parameters
    Type Name Description
    ApplicationCommandProperties[] properties

    A collection of properties to use when creating the commands.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IReadOnlyCollection<SocketApplicationCommand>>

    A task that represents the asynchronous creation operation. The task result contains a collection of commands that was created.

    | Improve this Doc View Source

    CreateApplicationCommandAsync(ApplicationCommandProperties, RequestOptions)

    Creates an application command within this guild.

    Declaration
    public async Task<SocketApplicationCommand> CreateApplicationCommandAsync(ApplicationCommandProperties properties, RequestOptions options = null)
    Parameters
    Type Name Description
    ApplicationCommandProperties properties

    The properties to use when creating the command.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<SocketApplicationCommand>

    A task that represents the asynchronous creation operation. The task result contains the command that was created.

    | Improve this Doc View Source

    CreateCategoryChannelAsync(String, Action<GuildChannelProperties>, RequestOptions)

    Creates a new channel category in this guild.

    Declaration
    public Task<RestCategoryChannel> CreateCategoryChannelAsync(string name, Action<GuildChannelProperties> func = null, RequestOptions options = null)
    Parameters
    Type Name Description
    String name

    The new name for the category.

    Action<GuildChannelProperties> func

    The delegate containing the properties to be applied to the channel upon its creation.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<RestCategoryChannel>

    A task that represents the asynchronous creation operation. The task result contains the newly created category channel.

    | Improve this Doc View Source

    CreateEmoteAsync(String, Image, Optional<IEnumerable<IRole>>, RequestOptions)

    Declaration
    public Task<GuildEmote> CreateEmoteAsync(string name, Image image, Optional<IEnumerable<IRole>> roles = default(Optional<IEnumerable<IRole>>), RequestOptions options = null)
    Parameters
    Type Name Description
    String name
    Image image
    Optional<IEnumerable<IRole>> roles
    RequestOptions options
    Returns
    Type Description
    Task<GuildEmote>
    | Improve this Doc View Source

    CreateEventAsync(String, DateTimeOffset, GuildScheduledEventType, GuildScheduledEventPrivacyLevel, String, Nullable<DateTimeOffset>, Nullable<UInt64>, String, Nullable<Image>, RequestOptions)

    Creates an event within this guild.

    Declaration
    public Task<RestGuildEvent> CreateEventAsync(string name, DateTimeOffset startTime, GuildScheduledEventType type, GuildScheduledEventPrivacyLevel privacyLevel = default(GuildScheduledEventPrivacyLevel), string description = null, DateTimeOffset? endTime = null, ulong? channelId = null, string location = null, Image? coverImage = null, RequestOptions options = null)
    Parameters
    Type Name Description
    String name

    The name of the event.

    DateTimeOffset startTime

    The start time of the event.

    GuildScheduledEventType type

    The type of the event.

    GuildScheduledEventPrivacyLevel privacyLevel

    The privacy level of the event.

    String description

    The description of the event.

    Nullable<DateTimeOffset> endTime

    The end time of the event.

    Nullable<UInt64> channelId

    The channel id of the event. The event must have a type of Stage or Voice in order to use this property.

    String location

    The location of the event; links are supported

    Nullable<Image> coverImage

    The optional banner image for the event.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<RestGuildEvent>

    A task that represents the asynchronous create operation.

    | Improve this Doc View Source

    CreateRoleAsync(String, Nullable<GuildPermissions>, Nullable<Color>, Boolean, Boolean, RequestOptions)

    Creates a new role with the provided name.

    Declaration
    public Task<RestRole> CreateRoleAsync(string name, GuildPermissions? permissions = null, Color? color = null, bool isHoisted = false, bool isMentionable = false, RequestOptions options = null)
    Parameters
    Type Name Description
    String name

    The new name for the role.

    Nullable<GuildPermissions> permissions

    The guild permission that the role should possess.

    Nullable<Color> color

    The color of the role.

    Boolean isHoisted

    Whether the role is separated from others on the sidebar.

    Boolean isMentionable

    Whether the role can be mentioned.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<RestRole>

    A task that represents the asynchronous creation operation. The task result contains the newly created role.

    | Improve this Doc View Source

    CreateStageChannelAsync(String, Action<VoiceChannelProperties>, RequestOptions)

    Creates a new stage channel in this guild.

    Declaration
    public Task<RestStageChannel> CreateStageChannelAsync(string name, Action<VoiceChannelProperties> func = null, RequestOptions options = null)
    Parameters
    Type Name Description
    String name

    The new name for the stage channel.

    Action<VoiceChannelProperties> func

    The delegate containing the properties to be applied to the channel upon its creation.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<RestStageChannel>

    A task that represents the asynchronous creation operation. The task result contains the newly created stage channel.

    | Improve this Doc View Source

    CreateStickerAsync(String, String, IEnumerable<String>, Image, RequestOptions)

    Creates a new sticker in this guild.

    Declaration
    public async Task<SocketCustomSticker> CreateStickerAsync(string name, string description, IEnumerable<string> tags, Image image, RequestOptions options = null)
    Parameters
    Type Name Description
    String name

    The name of the sticker.

    String description

    The description of the sticker.

    IEnumerable<String> tags

    The tags of the sticker.

    Image image

    The image of the new emote.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<SocketCustomSticker>

    A task that represents the asynchronous creation operation. The task result contains the created sticker.

    | Improve this Doc View Source

    CreateStickerAsync(String, String, IEnumerable<String>, Stream, String, RequestOptions)

    Creates a new sticker in this guild

    Declaration
    public async Task<SocketCustomSticker> CreateStickerAsync(string name, string description, IEnumerable<string> tags, Stream stream, string filename, RequestOptions options = null)
    Parameters
    Type Name Description
    String name

    The name of the sticker.

    String description

    The description of the sticker.

    IEnumerable<String> tags

    The tags of the sticker.

    Stream stream

    The stream containing the file data.

    String filename

    The name of the file with the extension, ex: image.png.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<SocketCustomSticker>

    A task that represents the asynchronous creation operation. The task result contains the created sticker.

    | Improve this Doc View Source

    CreateStickerAsync(String, String, IEnumerable<String>, String, RequestOptions)

    Creates a new sticker in this guild

    Declaration
    public Task<SocketCustomSticker> CreateStickerAsync(string name, string description, IEnumerable<string> tags, string path, RequestOptions options = null)
    Parameters
    Type Name Description
    String name

    The name of the sticker.

    String description

    The description of the sticker.

    IEnumerable<String> tags

    The tags of the sticker.

    String path

    The path of the file to upload.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<SocketCustomSticker>

    A task that represents the asynchronous creation operation. The task result contains the created sticker.

    | Improve this Doc View Source

    CreateTextChannelAsync(String, Action<TextChannelProperties>, RequestOptions)

    Creates a new text channel in this guild.

    Declaration
    public Task<RestTextChannel> CreateTextChannelAsync(string name, Action<TextChannelProperties> func = null, RequestOptions options = null)
    Parameters
    Type Name Description
    String name

    The new name for the text channel.

    Action<TextChannelProperties> func

    The delegate containing the properties to be applied to the channel upon its creation.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<RestTextChannel>

    A task that represents the asynchronous creation operation. The task result contains the newly created text channel.

    Examples

    The following example creates a new text channel under an existing category named Wumpus with a set topic.

    var categories = await guild.GetCategoriesAsync();
    var targetCategory = categories.FirstOrDefault(x => x.Name == "wumpus");
    if (targetCategory == null) return;
    await Context.Guild.CreateTextChannelAsync(name, x =>
    {
        x.CategoryId = targetCategory.Id;
        x.Topic = $"This channel was created at {DateTimeOffset.UtcNow} by {user}.";
    });
    | Improve this Doc View Source

    CreateVoiceChannelAsync(String, Action<VoiceChannelProperties>, RequestOptions)

    Creates a new voice channel in this guild.

    Declaration
    public Task<RestVoiceChannel> CreateVoiceChannelAsync(string name, Action<VoiceChannelProperties> func = null, RequestOptions options = null)
    Parameters
    Type Name Description
    String name

    The new name for the voice channel.

    Action<VoiceChannelProperties> func

    The delegate containing the properties to be applied to the channel upon its creation.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<RestVoiceChannel>

    A task that represents the asynchronous creation operation. The task result contains the newly created voice channel.

    | Improve this Doc View Source

    DeleteApplicationCommandsAsync(RequestOptions)

    Deletes all application commands in the current guild.

    Declaration
    public Task DeleteApplicationCommandsAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task

    A task that represents the asynchronous delete operation.

    | Improve this Doc View Source

    DeleteAsync(RequestOptions)

    Declaration
    public Task DeleteAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    DeleteEmoteAsync(GuildEmote, RequestOptions)

    Declaration
    public Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null)
    Parameters
    Type Name Description
    GuildEmote emote
    RequestOptions options
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    DeleteIntegrationAsync(UInt64, RequestOptions)

    Declaration
    public Task DeleteIntegrationAsync(ulong id, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 id
    RequestOptions options
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    DeleteStickerAsync(SocketCustomSticker, RequestOptions)

    Deletes a sticker within this guild.

    Declaration
    public Task DeleteStickerAsync(SocketCustomSticker sticker, RequestOptions options = null)
    Parameters
    Type Name Description
    SocketCustomSticker sticker

    The sticker to delete.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task

    A task that represents the asynchronous removal operation.

    | Improve this Doc View Source

    DownloadUsersAsync()

    Declaration
    public async Task DownloadUsersAsync()
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    GetApplicationCommandAsync(UInt64, CacheMode, RequestOptions)

    Gets an application command within this guild with the specified id.

    Declaration
    public async ValueTask<SocketApplicationCommand> GetApplicationCommandAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 id

    The id of the application command to get.

    CacheMode mode

    The CacheMode that determines whether the object should be fetched from cache.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    ValueTask<SocketApplicationCommand>

    A ValueTask that represents the asynchronous get operation. The task result contains a IApplicationCommand if found, otherwise null.

    | Improve this Doc View Source

    GetApplicationCommandsAsync(RequestOptions)

    Gets a collection of slash commands created by the current user in this guild.

    Declaration
    public async Task<IReadOnlyCollection<SocketApplicationCommand>> GetApplicationCommandsAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IReadOnlyCollection<SocketApplicationCommand>>

    A task that represents the asynchronous get operation. The task result contains a read-only collection of slash commands created by the current user.

    | Improve this Doc View Source

    GetAuditLogsAsync(Int32, RequestOptions, Nullable<UInt64>, Nullable<UInt64>, Nullable<ActionType>)

    Gets the specified number of audit log entries for this guild.

    Declaration
    public IAsyncEnumerable<IReadOnlyCollection<RestAuditLogEntry>> GetAuditLogsAsync(int limit, RequestOptions options = null, ulong? beforeId = null, ulong? userId = null, ActionType? actionType = null)
    Parameters
    Type Name Description
    Int32 limit

    The number of audit log entries to fetch.

    RequestOptions options

    The options to be used when sending the request.

    Nullable<UInt64> beforeId

    The audit log entry ID to filter entries before.

    Nullable<UInt64> userId

    The user ID to filter entries for.

    Nullable<ActionType> actionType

    The type of actions to filter.

    Returns
    Type Description
    IAsyncEnumerable<IReadOnlyCollection<RestAuditLogEntry>>

    A task that represents the asynchronous get operation. The task result contains a read-only collection of the requested audit log entries.

    | Improve this Doc View Source

    GetBanAsync(IUser, RequestOptions)

    Gets a ban object for a banned user.

    Declaration
    public Task<RestBan> GetBanAsync(IUser user, RequestOptions options = null)
    Parameters
    Type Name Description
    IUser user

    The banned user.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<RestBan>

    A task that represents the asynchronous get operation. The task result contains a ban object, which contains the user information and the reason for the ban; null if the ban entry cannot be found.

    | Improve this Doc View Source

    GetBanAsync(UInt64, RequestOptions)

    Gets a ban object for a banned user.

    Declaration
    public Task<RestBan> GetBanAsync(ulong userId, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 userId

    The snowflake identifier for the banned user.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<RestBan>

    A task that represents the asynchronous get operation. The task result contains a ban object, which contains the user information and the reason for the ban; null if the ban entry cannot be found.

    | Improve this Doc View Source

    GetBansAsync(IUser, Direction, Int32, RequestOptions)

    Declaration
    public IAsyncEnumerable<IReadOnlyCollection<RestBan>> GetBansAsync(IUser fromUser, Direction dir, int limit = null, RequestOptions options = null)
    Parameters
    Type Name Description
    IUser fromUser
    Direction dir
    Int32 limit
    RequestOptions options
    Returns
    Type Description
    IAsyncEnumerable<IReadOnlyCollection<RestBan>>
    | Improve this Doc View Source

    GetBansAsync(Int32, RequestOptions)

    Declaration
    public IAsyncEnumerable<IReadOnlyCollection<RestBan>> GetBansAsync(int limit = null, RequestOptions options = null)
    Parameters
    Type Name Description
    Int32 limit
    RequestOptions options
    Returns
    Type Description
    IAsyncEnumerable<IReadOnlyCollection<RestBan>>
    | Improve this Doc View Source

    GetBansAsync(UInt64, Direction, Int32, RequestOptions)

    Declaration
    public IAsyncEnumerable<IReadOnlyCollection<RestBan>> GetBansAsync(ulong fromUserId, Direction dir, int limit = null, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 fromUserId
    Direction dir
    Int32 limit
    RequestOptions options
    Returns
    Type Description
    IAsyncEnumerable<IReadOnlyCollection<RestBan>>
    | Improve this Doc View Source

    GetCategoryChannel(UInt64)

    Gets a category channel in this guild.

    Declaration
    public SocketCategoryChannel GetCategoryChannel(ulong id)
    Parameters
    Type Name Description
    UInt64 id

    The snowflake identifier for the category channel.

    Returns
    Type Description
    SocketCategoryChannel

    A category channel associated with the specified id; null if none is found.

    | Improve this Doc View Source

    GetChannel(UInt64)

    Gets a channel in this guild.

    Declaration
    public SocketGuildChannel GetChannel(ulong id)
    Parameters
    Type Name Description
    UInt64 id

    The snowflake identifier for the channel.

    Returns
    Type Description
    SocketGuildChannel

    A generic channel associated with the specified id; null if none is found.

    | Improve this Doc View Source

    GetEmoteAsync(UInt64, RequestOptions)

    Declaration
    public Task<GuildEmote> GetEmoteAsync(ulong id, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 id
    RequestOptions options
    Returns
    Type Description
    Task<GuildEmote>
    | Improve this Doc View Source

    GetEmotesAsync(RequestOptions)

    Declaration
    public Task<IReadOnlyCollection<GuildEmote>> GetEmotesAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options
    Returns
    Type Description
    Task<IReadOnlyCollection<GuildEmote>>
    | Improve this Doc View Source

    GetEvent(UInt64)

    Gets an event in this guild.

    Declaration
    public SocketGuildEvent GetEvent(ulong id)
    Parameters
    Type Name Description
    UInt64 id

    The snowflake identifier for the event.

    Returns
    Type Description
    SocketGuildEvent

    An event that is associated with the specified id; null if none is found.

    | Improve this Doc View Source

    GetEventAsync(UInt64, RequestOptions)

    Gets an event within this guild.

    Declaration
    public Task<RestGuildEvent> GetEventAsync(ulong id, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 id

    The snowflake identifier for the event.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<RestGuildEvent>

    A task that represents the asynchronous get operation.

    | Improve this Doc View Source

    GetEventsAsync(RequestOptions)

    Gets all active events within this guild.

    Declaration
    public Task<IReadOnlyCollection<RestGuildEvent>> GetEventsAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IReadOnlyCollection<RestGuildEvent>>

    A task that represents the asynchronous get operation.

    | Improve this Doc View Source

    GetIntegrationsAsync(RequestOptions)

    Declaration
    public Task<IReadOnlyCollection<RestIntegration>> GetIntegrationsAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options
    Returns
    Type Description
    Task<IReadOnlyCollection<RestIntegration>>
    | Improve this Doc View Source

    GetInvitesAsync(RequestOptions)

    Gets a collection of all invites in this guild.

    Declaration
    public Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IReadOnlyCollection<RestInviteMetadata>>

    A task that represents the asynchronous get operation. The task result contains a read-only collection of invite metadata, each representing information for an invite found within this guild.

    | Improve this Doc View Source

    GetRole(UInt64)

    Gets a role in this guild.

    Declaration
    public SocketRole GetRole(ulong id)
    Parameters
    Type Name Description
    UInt64 id

    The snowflake identifier for the role.

    Returns
    Type Description
    SocketRole

    A role that is associated with the specified id; null if none is found.

    | Improve this Doc View Source

    GetStageChannel(UInt64)

    Gets a stage channel in this guild.

    Declaration
    public SocketStageChannel GetStageChannel(ulong id)
    Parameters
    Type Name Description
    UInt64 id

    The snowflake identifier for the stage channel.

    Returns
    Type Description
    SocketStageChannel

    A stage channel associated with the specified id; null if none is found.

    | Improve this Doc View Source

    GetSticker(UInt64)

    Gets a specific sticker within this guild.

    Declaration
    public SocketCustomSticker GetSticker(ulong id)
    Parameters
    Type Name Description
    UInt64 id

    The id of the sticker to get.

    Returns
    Type Description
    SocketCustomSticker

    A sticker, if none is found then null.

    | Improve this Doc View Source

    GetStickerAsync(UInt64, CacheMode, RequestOptions)

    Gets a specific sticker within this guild.

    Declaration
    public async ValueTask<SocketCustomSticker> GetStickerAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 id

    The id of the sticker to get.

    CacheMode mode

    The CacheMode that determines whether the object should be fetched from cache.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    ValueTask<SocketCustomSticker>

    A task that represents the asynchronous get operation. The task result contains the sticker found with the specified id; null if none is found.

    | Improve this Doc View Source

    GetStickersAsync(CacheMode, RequestOptions)

    Gets a collection of all stickers within this guild.

    Declaration
    public async ValueTask<IReadOnlyCollection<SocketCustomSticker>> GetStickersAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
    Parameters
    Type Name Description
    CacheMode mode

    The CacheMode that determines whether the object should be fetched from cache.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    ValueTask<IReadOnlyCollection<SocketCustomSticker>>

    A task that represents the asynchronous get operation. The task result contains a read-only collection of stickers found within the guild.

    | Improve this Doc View Source

    GetTextChannel(UInt64)

    Gets a text channel in this guild.

    Declaration
    public SocketTextChannel GetTextChannel(ulong id)
    Parameters
    Type Name Description
    UInt64 id

    The snowflake identifier for the text channel.

    Returns
    Type Description
    SocketTextChannel

    A text channel associated with the specified id; null if none is found.

    | Improve this Doc View Source

    GetThreadChannel(UInt64)

    Gets a thread in this guild.

    Declaration
    public SocketThreadChannel GetThreadChannel(ulong id)
    Parameters
    Type Name Description
    UInt64 id

    The snowflake identifier for the thread.

    Returns
    Type Description
    SocketThreadChannel

    A thread channel associated with the specified id; null if none is found.

    | Improve this Doc View Source

    GetUser(UInt64)

    Gets a user from this guild.

    Declaration
    public SocketGuildUser GetUser(ulong id)
    Parameters
    Type Name Description
    UInt64 id

    The snowflake identifier of the user.

    Returns
    Type Description
    SocketGuildUser

    A guild user associated with the specified id; null if none is found.

    Remarks

    This method retrieves a user found within this guild.

    note

    This may return null in the WebSocket implementation due to incomplete user collection in large guilds.

    | Improve this Doc View Source

    GetUsersAsync(RequestOptions)

    Gets a collection of all users in this guild.

    Declaration
    public IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> GetUsersAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    IAsyncEnumerable<IReadOnlyCollection<IGuildUser>>

    A task that represents the asynchronous get operation. The task result contains a collection of guild users found within this guild.

    Remarks

    This method retrieves all users found within this guild throught REST.

    Users returned by this method are not cached.

    | Improve this Doc View Source

    GetVanityInviteAsync(RequestOptions)

    Gets the vanity invite URL of this guild.

    Declaration
    public Task<RestInviteMetadata> GetVanityInviteAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<RestInviteMetadata>

    A task that represents the asynchronous get operation. The task result contains the partial metadata of the vanity invite found within this guild; null if none is found.

    | Improve this Doc View Source

    GetVoiceChannel(UInt64)

    Gets a voice channel in this guild.

    Declaration
    public SocketVoiceChannel GetVoiceChannel(ulong id)
    Parameters
    Type Name Description
    UInt64 id

    The snowflake identifier for the voice channel.

    Returns
    Type Description
    SocketVoiceChannel

    A voice channel associated with the specified id; null if none is found.

    | Improve this Doc View Source

    GetVoiceRegionsAsync(RequestOptions)

    Gets a collection of all the voice regions this guild can access.

    Declaration
    public Task<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IReadOnlyCollection<RestVoiceRegion>>

    A task that represents the asynchronous get operation. The task result contains a read-only collection of voice regions the guild can access.

    | Improve this Doc View Source

    GetWebhookAsync(UInt64, RequestOptions)

    Gets a webhook found within this guild.

    Declaration
    public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 id

    The identifier for the webhook.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<RestWebhook>

    A task that represents the asynchronous get operation. The task result contains the webhook with the specified id; null if none is found.

    | Improve this Doc View Source

    GetWebhooksAsync(RequestOptions)

    Gets a collection of all webhook from this guild.

    Declaration
    public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IReadOnlyCollection<RestWebhook>>

    A task that represents the asynchronous get operation. The task result contains a read-only collection of webhooks found within the guild.

    | Improve this Doc View Source

    LeaveAsync(RequestOptions)

    Declaration
    public Task LeaveAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    ModifyAsync(Action<GuildProperties>, RequestOptions)

    Declaration
    public Task ModifyAsync(Action<GuildProperties> func, RequestOptions options = null)
    Parameters
    Type Name Description
    Action<GuildProperties> func
    RequestOptions options
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    ModifyEmoteAsync(GuildEmote, Action<EmoteProperties>, RequestOptions)

    Declaration
    public Task<GuildEmote> ModifyEmoteAsync(GuildEmote emote, Action<EmoteProperties> func, RequestOptions options = null)
    Parameters
    Type Name Description
    GuildEmote emote
    Action<EmoteProperties> func
    RequestOptions options
    Returns
    Type Description
    Task<GuildEmote>
    | Improve this Doc View Source

    ModifyWidgetAsync(Action<GuildWidgetProperties>, RequestOptions)

    Declaration
    public Task ModifyWidgetAsync(Action<GuildWidgetProperties> func, RequestOptions options = null)
    Parameters
    Type Name Description
    Action<GuildWidgetProperties> func
    RequestOptions options
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    MoveAsync(IGuildUser, IVoiceChannel)

    Moves the user to the voice channel.

    Declaration
    public Task MoveAsync(IGuildUser user, IVoiceChannel targetChannel)
    Parameters
    Type Name Description
    IGuildUser user

    The user to move.

    IVoiceChannel targetChannel

    the channel where the user gets moved to.

    Returns
    Type Description
    Task

    A task that represents the asynchronous operation for moving a user.

    | Improve this Doc View Source

    PruneUsersAsync(Int32, Boolean, RequestOptions, IEnumerable<UInt64>)

    Declaration
    public Task<int> PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null, IEnumerable<ulong> includeRoleIds = null)
    Parameters
    Type Name Description
    Int32 days
    Boolean simulate
    RequestOptions options
    IEnumerable<UInt64> includeRoleIds
    Returns
    Type Description
    Task<Int32>
    | Improve this Doc View Source

    PurgeUserCache()

    Purges this guild's user cache.

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

    PurgeUserCache(Func<SocketGuildUser, Boolean>)

    Purges this guild's user cache.

    Declaration
    public void PurgeUserCache(Func<SocketGuildUser, bool> predicate)
    Parameters
    Type Name Description
    Func<SocketGuildUser, Boolean> predicate

    The predicate used to select which users to clear.

    | Improve this Doc View Source

    RemoveBanAsync(IUser, RequestOptions)

    Declaration
    public Task RemoveBanAsync(IUser user, RequestOptions options = null)
    Parameters
    Type Name Description
    IUser user
    RequestOptions options
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    RemoveBanAsync(UInt64, RequestOptions)

    Declaration
    public Task RemoveBanAsync(ulong userId, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 userId
    RequestOptions options
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    ReorderChannelsAsync(IEnumerable<ReorderChannelProperties>, RequestOptions)

    Declaration
    public Task ReorderChannelsAsync(IEnumerable<ReorderChannelProperties> args, RequestOptions options = null)
    Parameters
    Type Name Description
    IEnumerable<ReorderChannelProperties> args
    RequestOptions options
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    ReorderRolesAsync(IEnumerable<ReorderRoleProperties>, RequestOptions)

    Declaration
    public Task ReorderRolesAsync(IEnumerable<ReorderRoleProperties> args, RequestOptions options = null)
    Parameters
    Type Name Description
    IEnumerable<ReorderRoleProperties> args
    RequestOptions options
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    SearchUsersAsync(String, Int32, RequestOptions)

    Gets a collection of users in this guild that the name or nickname starts with the provided at query.

    Declaration
    public Task<IReadOnlyCollection<RestGuildUser>> SearchUsersAsync(string query, int limit = null, RequestOptions options = null)
    Parameters
    Type Name Description
    String query

    The partial name or nickname to search.

    Int32 limit

    The maximum number of users to be gotten.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IReadOnlyCollection<RestGuildUser>>

    A task that represents the asynchronous get operation. The task result contains a collection of guild users that the name or nickname starts with the provided at query.

    Remarks

    The limit can not be higher than MaxUsersPerBatch.

    | Improve this Doc View Source

    ToString()

    Gets the name of the guild.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    A string that resolves to Name.

    Explicit Interface Implementations

    | Improve this Doc View Source

    IGuild.AudioClient

    Gets the IAudioClient currently associated with this guild.

    Declaration
    IAudioClient IGuild.AudioClient { get; }
    Returns
    Type Description
    IAudioClient

    An IAudioClient currently associated with this guild.

    | Improve this Doc View Source

    IGuild.EveryoneRole

    Gets the built-in role containing all users in this guild.

    Declaration
    IRole IGuild.EveryoneRole { get; }
    Returns
    Type Description
    IRole

    A role object that represents an @everyone role in this guild.

    Implements

    IEntity<TId>
    IGuild
    IDeletable
    ISnowflakeEntity
    IEntity<TId>
    IDisposable

    Theme

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