Class DiscordGuild
Represents a Discord guild.
Namespace: DisCatSharp.Entities
Assembly: DisCatSharp.dll
Syntax
public class DiscordGuild : SnowflakeObject, IEquatable<DiscordGuild>
Properties
| Improve this Doc View SourceAfkChannel
Gets the guild's AFK voice channel.
Declaration
public DiscordChannel AfkChannel { get; }
Property Value
Type | Description |
---|---|
DiscordChannel |
AfkTimeout
Gets the guild's AFK timeout.
Declaration
public int AfkTimeout { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
ApplicationId
Gets the application id of this guild if it is bot created.
Declaration
public ulong? ApplicationId { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.UInt64> |
ApproximateMemberCount
Gets the approximate number of members in this guild, when using GetGuildAsync(UInt64, Nullable<Boolean>) and having withCounts set to true.
Declaration
public int? ApproximateMemberCount { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
ApproximatePresenceCount
Gets the approximate number of presences in this guild, when using GetGuildAsync(UInt64, Nullable<Boolean>) and having withCounts set to true.
Declaration
public int? ApproximatePresenceCount { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
BannerHash
Gets this guild's banner hash, when applicable.
Declaration
public string BannerHash { get; }
Property Value
Type | Description |
---|---|
System.String |
BannerUrl
Gets this guild's banner in url form.
Declaration
public string BannerUrl { get; }
Property Value
Type | Description |
---|---|
System.String |
Channels
Gets a dictionary of all the channels associated with this guild. The dictionary's key is the channel ID.
Declaration
public IReadOnlyDictionary<ulong, DiscordChannel> Channels { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.UInt64, DiscordChannel> |
CurrentMember
Gets the guild member for current user.
Declaration
public DiscordMember CurrentMember { get; }
Property Value
Type | Description |
---|---|
DiscordMember |
DefaultMessageNotifications
Gets the guild's default notification settings.
Declaration
public DefaultMessageNotifications DefaultMessageNotifications { get; }
Property Value
Type | Description |
---|---|
DefaultMessageNotifications |
Description
Gets the guild description, when applicable.
Declaration
public string Description { get; }
Property Value
Type | Description |
---|---|
System.String |
DiscoverySplashHash
Gets the guild discovery splash's hash.
Declaration
public string DiscoverySplashHash { get; }
Property Value
Type | Description |
---|---|
System.String |
DiscoverySplashUrl
Gets the guild discovery splash's url.
Declaration
public string DiscoverySplashUrl { get; }
Property Value
Type | Description |
---|---|
System.String |
Emojis
Gets a collection of this guild's emojis.
Declaration
public IReadOnlyDictionary<ulong, DiscordEmoji> Emojis { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.UInt64, DiscordEmoji> |
EveryoneRole
Gets the @everyone role for this guild.
Declaration
public DiscordRole EveryoneRole { get; }
Property Value
Type | Description |
---|---|
DiscordRole |
ExplicitContentFilter
Gets the guild's explicit content filter settings.
Declaration
public ExplicitContentFilter ExplicitContentFilter { get; }
Property Value
Type | Description |
---|---|
ExplicitContentFilter |
Features
Gets the guild's features.
Declaration
public GuildFeatures Features { get; }
Property Value
Type | Description |
---|---|
GuildFeatures |
HasMemberVerificationGate
Whether this guild has enabled membership screening.
Declaration
public bool HasMemberVerificationGate { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
HasWelcomeScreen
Whether this guild has enabled the welcome screen.
Declaration
public bool HasWelcomeScreen { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
HubType
Gets this guild's hub type, if applicable.
Declaration
public HubType HubType { get; }
Property Value
Type | Description |
---|---|
HubType |
IconHash
Gets the guild icon's hash.
Declaration
public string IconHash { get; }
Property Value
Type | Description |
---|---|
System.String |
IconUrl
Gets the guild icon's url.
Declaration
public string IconUrl { get; }
Property Value
Type | Description |
---|---|
System.String |
IsCommunity
Whether this guild has the community feature enabled.
Declaration
public bool IsCommunity { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsLarge
Gets whether this guild is considered to be a large guild.
Declaration
public bool IsLarge { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsNsfw
Gets whether this guild is designated as NSFW.
Declaration
public bool IsNsfw { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsOwner
Gets whether the current user is the guild's owner.
Declaration
public bool IsOwner { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsUnavailable
Gets whether this guild is unavailable.
Declaration
public bool IsUnavailable { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
JoinedAt
Gets this guild's join date.
Declaration
public DateTimeOffset JoinedAt { get; }
Property Value
Type | Description |
---|---|
System.DateTimeOffset |
MaxMembers
Gets the maximum amount of members allowed for this guild.
Declaration
public int? MaxMembers { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
MaxPresences
Gets the maximum amount of presences allowed for this guild.
Declaration
public int? MaxPresences { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
MaxVideoChannelUsers
Gets the maximum amount of users allowed per video channel.
Declaration
public int? MaxVideoChannelUsers { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
MemberCount
Gets the total number of members in this guild.
Declaration
public int MemberCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Members
Gets a dictionary of all the members that belong to this guild. The dictionary's key is the member ID.
Declaration
public IReadOnlyDictionary<ulong, DiscordMember> Members { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.UInt64, DiscordMember> |
MfaLevel
Gets the required multi-factor authentication level for this guild.
Declaration
public MfaLevel MfaLevel { get; }
Property Value
Type | Description |
---|---|
MfaLevel |
Name
Gets the guild's name.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
NsfwLevel
Gets the guild's nsfw level.
Declaration
public NsfwLevel NsfwLevel { get; }
Property Value
Type | Description |
---|---|
NsfwLevel |
OrderedChannels
Gets a dictionary of all by position ordered channels associated with this guild. The dictionary's key is the channel ID.
Declaration
public IReadOnlyDictionary<ulong, DiscordChannel> OrderedChannels { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.UInt64, DiscordChannel> |
Owner
Gets the guild's owner.
Declaration
public DiscordMember Owner { get; }
Property Value
Type | Description |
---|---|
DiscordMember |
OwnerId
Gets the ID of the guild's owner.
Declaration
public ulong OwnerId { get; }
Property Value
Type | Description |
---|---|
System.UInt64 |
Permissions
Gets permissions for the user in the guild (does not include channel overrides)
Declaration
public Permissions? Permissions { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<Permissions> |
PreferredLocale
Gets the preferred locale of this guild.
This is used for server discovery, interactions and notices from Discord. Defaults to en-US.
Declaration
public string PreferredLocale { get; }
Property Value
Type | Description |
---|---|
System.String |
PremiumProgressBarEnabled
Whether the premium progress bar is enabled.
Declaration
public bool PremiumProgressBarEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
PremiumSubscriptionCount
Gets the amount of members that boosted this guild.
Declaration
public int? PremiumSubscriptionCount { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
PremiumTier
Gets this guild's premium tier (Nitro boosting).
Declaration
public PremiumTier PremiumTier { get; }
Property Value
Type | Description |
---|---|
PremiumTier |
PublicUpdatesChannel
Gets the public updates channel (where admins and moderators receive messages from Discord) for this guild.
This is only available if the guild is considered "discoverable".
Declaration
public DiscordChannel PublicUpdatesChannel { get; }
Property Value
Type | Description |
---|---|
DiscordChannel |
RawFeatures
Gets a collection of this guild's features.
Declaration
public IReadOnlyList<string> RawFeatures { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<System.String> |
RegisteredApplicationCommands
List of DiscordApplicationCommand. Null if DisCatSharp.ApplicationCommands is not used or no guild commands are registered.
Declaration
public ReadOnlyCollection<DiscordApplicationCommand> RegisteredApplicationCommands { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<DiscordApplicationCommand> |
Roles
Gets a collection of this guild's roles.
Declaration
public IReadOnlyDictionary<ulong, DiscordRole> Roles { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.UInt64, DiscordRole> |
RulesChannel
Gets the rules channel for this guild.
This is only available if the guild is considered "discoverable".
Declaration
public DiscordChannel RulesChannel { get; }
Property Value
Type | Description |
---|---|
DiscordChannel |
ScheduledEvents
Gets a dictionary of all scheduled events.
Declaration
public IReadOnlyDictionary<ulong, DiscordScheduledEvent> ScheduledEvents { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.UInt64, DiscordScheduledEvent> |
SplashHash
Gets the guild splash's hash.
Declaration
public string SplashHash { get; }
Property Value
Type | Description |
---|---|
System.String |
SplashUrl
Gets the guild splash's url.
Declaration
public string SplashUrl { get; }
Property Value
Type | Description |
---|---|
System.String |
StageInstances
Gets a dictionary of all active stage instances. The dictionary's key is the stage ID.
Declaration
public IReadOnlyDictionary<ulong, DiscordStageInstance> StageInstances { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.UInt64, DiscordStageInstance> |
Stickers
Gets a collection of this guild's stickers.
Declaration
public IReadOnlyDictionary<ulong, DiscordSticker> Stickers { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.UInt64, DiscordSticker> |
SystemChannel
Gets the channel where system messages (such as boost and welcome messages) are sent.
Declaration
public DiscordChannel SystemChannel { get; }
Property Value
Type | Description |
---|---|
DiscordChannel |
SystemChannelFlags
Gets the settings for this guild's system channel.
Declaration
public SystemChannelFlags SystemChannelFlags { get; }
Property Value
Type | Description |
---|---|
SystemChannelFlags |
Threads
Gets a dictionary of all the active threads associated with this guild the user has permission to view. The dictionary's key is the channel ID.
Declaration
public IReadOnlyDictionary<ulong, DiscordThreadChannel> Threads { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.UInt64, DiscordThreadChannel> |
VanityUrlCode
Gets the vanity URL code for this guild, when applicable.
Declaration
public string VanityUrlCode { get; }
Property Value
Type | Description |
---|---|
System.String |
VerificationLevel
Gets the guild's verification level.
Declaration
public VerificationLevel VerificationLevel { get; }
Property Value
Type | Description |
---|---|
VerificationLevel |
VoiceRegion
Gets the guild's voice region.
Declaration
public DiscordVoiceRegion VoiceRegion { get; }
Property Value
Type | Description |
---|---|
DiscordVoiceRegion |
VoiceStates
Gets a dictionary of all the voice states for this guilds. The key for this dictionary is the ID of the user the voice state corresponds to.
Declaration
public IReadOnlyDictionary<ulong, DiscordVoiceState> VoiceStates { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.UInt64, DiscordVoiceState> |
WidgetChannel
Gets the widget channel for this guild.
Declaration
public DiscordChannel WidgetChannel { get; }
Property Value
Type | Description |
---|---|
DiscordChannel |
WidgetEnabled
Gets whether this guild's widget is enabled.
Declaration
public bool? WidgetEnabled { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> |
Methods
| Improve this Doc View SourceAddMemberAsync(DiscordUser, String, String, IEnumerable<DiscordRole>, Boolean, Boolean)
Adds a new member to this guild
Declaration
public Task AddMemberAsync(DiscordUser user, string accessToken, string nickname = null, IEnumerable<DiscordRole> roles = null, bool muted = false, bool deaf = false)
Parameters
Type | Name | Description |
---|---|---|
DiscordUser | user | User to add |
System.String | accessToken | User's access token (OAuth2) |
System.String | nickname | new nickname |
System.Collections.Generic.IEnumerable<DiscordRole> | roles | new roles |
System.Boolean | muted | whether this user has to be muted |
System.Boolean | deaf | whether this user has to be deafened |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the CreateInstantInvite permission. |
NotFoundException | Thrown when the |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
AttachUserIntegrationAsync(DiscordIntegration)
Attaches an integration from current user to this guild.
Declaration
public Task<DiscordIntegration> AttachUserIntegrationAsync(DiscordIntegration integration)
Parameters
Type | Name | Description |
---|---|---|
DiscordIntegration | integration | Integration to attach. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordIntegration> | The integration after being attached to the guild. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageGuild permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
BanMemberAsync(DiscordMember, Int32, String)
Bans a specified member from this guild.
Declaration
public Task BanMemberAsync(DiscordMember member, int deleteMessageDays = 0, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
DiscordMember | member | Member to ban. |
System.Int32 | deleteMessageDays | How many days to remove messages from. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the BanMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
BanMemberAsync(UInt64, Int32, String)
Bans a specified user by ID. This doesn't require the user to be in this guild.
Declaration
public Task BanMemberAsync(ulong userId, int deleteMessageDays = 0, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | userId | ID of the user to ban. |
System.Int32 | deleteMessageDays | How many days to remove messages from. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the BanMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
BulkOverwriteApplicationCommandsAsync(IEnumerable<DiscordApplicationCommand>)
Overwrites the existing application commands in this guild. New commands are automatically created and missing commands are automatically delete
Declaration
public Task<IReadOnlyList<DiscordApplicationCommand>> BulkOverwriteApplicationCommandsAsync(IEnumerable<DiscordApplicationCommand> commands)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<DiscordApplicationCommand> | commands | The list of commands to overwrite with. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordApplicationCommand>> | The list of guild commands |
CreateApplicationCommandAsync(DiscordApplicationCommand)
Creates or overwrites a application command in this guild.
Declaration
public Task<DiscordApplicationCommand> CreateApplicationCommandAsync(DiscordApplicationCommand command)
Parameters
Type | Name | Description |
---|---|---|
DiscordApplicationCommand | command | The command to create. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordApplicationCommand> | The created command. |
CreateChannelAsync(String, ChannelType, DiscordChannel, Optional<String>, Nullable<Int32>, Nullable<Int32>, IEnumerable<DiscordOverwriteBuilder>, Nullable<Boolean>, Optional<Nullable<Int32>>, Nullable<VideoQualityMode>, Nullable<ThreadAutoArchiveDuration>, String)
Creates a new channel in this guild.
Declaration
public Task<DiscordChannel> CreateChannelAsync(string name, ChannelType type, DiscordChannel parent = null, Optional<string> topic = default(Optional<string>), int? bitrate = null, int? userLimit = null, IEnumerable<DiscordOverwriteBuilder> overwrites = null, bool? nsfw = null, Optional<int?> perUserRateLimit = default(Optional<int?>), VideoQualityMode? qualityMode = null, ThreadAutoArchiveDuration? defaultAutoArchiveDuration = null, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the new channel. |
ChannelType | type | Type of the new channel. |
DiscordChannel | parent | Category to put this channel in. |
Optional<System.String> | topic | Topic of the channel. |
System.Nullable<System.Int32> | bitrate | Bitrate of the channel. Applies to voice only. |
System.Nullable<System.Int32> | userLimit | Maximum number of users in the channel. Applies to voice only. |
System.Collections.Generic.IEnumerable<DiscordOverwriteBuilder> | overwrites | Permission overwrites for this channel. |
System.Nullable<System.Boolean> | nsfw | Whether the channel is to be flagged as not safe for work. Applies to text only. |
Optional<System.Nullable<System.Int32>> | perUserRateLimit | Slow mode timeout for users. |
System.Nullable<VideoQualityMode> | qualityMode | Video quality mode of the channel. Applies to voice only. |
System.Nullable<ThreadAutoArchiveDuration> | defaultAutoArchiveDuration | The default auto archive duration for new threads. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordChannel> | The newly-created channel. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageChannels permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
CreateChannelCategoryAsync(String, IEnumerable<DiscordOverwriteBuilder>, String)
Creates a new channel category in this guild.
Declaration
public Task<DiscordChannel> CreateChannelCategoryAsync(string name, IEnumerable<DiscordOverwriteBuilder> overwrites = null, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the new category. |
System.Collections.Generic.IEnumerable<DiscordOverwriteBuilder> | overwrites | Permission overwrites for this category. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordChannel> | The newly-created channel category. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageChannels permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
CreateEmojiAsync(String, Stream, IEnumerable<DiscordRole>, String)
Creates a new custom emoji for this guild.
Declaration
public Task<DiscordGuildEmoji> CreateEmojiAsync(string name, Stream image, IEnumerable<DiscordRole> roles = null, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the new emoji. |
System.IO.Stream | image | Image to use as the emoji. |
System.Collections.Generic.IEnumerable<DiscordRole> | roles | Roles for which the emoji will be available. This works only if your application is whitelisted as integration. |
System.String | reason | Reason for audit log. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuildEmoji> | The newly-created emoji. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageEmojisAndStickers permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
CreateExternalScheduledEventAsync(String, DateTimeOffset, DateTimeOffset, String, String, Optional<Stream>, String)
Creates a scheduled event with type External.
Declaration
public async Task<DiscordScheduledEvent> CreateExternalScheduledEventAsync(string name, DateTimeOffset scheduledStartTime, DateTimeOffset scheduledEndTime, string location, string description = null, Optional<Stream> coverImage = default(Optional<Stream>), string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
System.DateTimeOffset | scheduledStartTime | The scheduled start time. |
System.DateTimeOffset | scheduledEndTime | The scheduled end time. |
System.String | location | The location of the external event. |
System.String | description | The description. |
Optional<System.IO.Stream> | coverImage | The cover image. |
System.String | reason | The reason. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordScheduledEvent> | A scheduled event. |
Exceptions
Type | Condition |
---|---|
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
CreateNewsChannelAsync(String, IEnumerable<DiscordOverwriteBuilder>, String, ThreadAutoArchiveDuration)
Creates a new news channel in this guild.
Declaration
public Task<DiscordChannel> CreateNewsChannelAsync(string name, IEnumerable<DiscordOverwriteBuilder> overwrites = null, string reason = null, ThreadAutoArchiveDuration defaultAutoArchiveDuration = ThreadAutoArchiveDuration.OneDay)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the new news channel. |
System.Collections.Generic.IEnumerable<DiscordOverwriteBuilder> | overwrites | Permission overwrites for this news channel. |
System.String | reason | Reason for audit logs. |
ThreadAutoArchiveDuration | defaultAutoArchiveDuration | The default auto archive duration for new threads. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordChannel> | The newly-created news channel. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageChannels. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
System.NotSupportedException | Thrown when the guilds has not enabled community. |
CreateRoleAsync(String, Nullable<Permissions>, Nullable<DiscordColor>, Nullable<Boolean>, Nullable<Boolean>, String)
Creates a new role in this guild.
Declaration
public Task<DiscordRole> CreateRoleAsync(string name = null, Permissions? permissions = null, DiscordColor? color = null, bool? hoist = null, bool? mentionable = null, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the role. |
System.Nullable<Permissions> | permissions | Permissions for the role. |
System.Nullable<DiscordColor> | color | Color for the role. |
System.Nullable<System.Boolean> | hoist | Whether the role is to be hoisted. |
System.Nullable<System.Boolean> | mentionable | Whether the role is to be mentionable. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordRole> | The newly-created role. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageRoles permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
CreateScheduledEventAsync(String, DateTimeOffset, Nullable<DateTimeOffset>, DiscordChannel, DiscordScheduledEventEntityMetadata, String, ScheduledEventEntityType, Optional<Stream>, String)
Creates a scheduled event.
Declaration
public async Task<DiscordScheduledEvent> CreateScheduledEventAsync(string name, DateTimeOffset scheduledStartTime, DateTimeOffset? scheduledEndTime = null, DiscordChannel channel = null, DiscordScheduledEventEntityMetadata metadata = null, string description = null, ScheduledEventEntityType type = ScheduledEventEntityType.StageInstance, Optional<Stream> coverImage = default(Optional<Stream>), string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
System.DateTimeOffset | scheduledStartTime | The scheduled start time. |
System.Nullable<System.DateTimeOffset> | scheduledEndTime | The scheduled end time. |
DiscordChannel | channel | The channel. |
DiscordScheduledEventEntityMetadata | metadata | The metadata. |
System.String | description | The description. |
ScheduledEventEntityType | type | The type. |
Optional<System.IO.Stream> | coverImage | The cover image. |
System.String | reason | The reason. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordScheduledEvent> | A scheduled event. |
Exceptions
Type | Condition |
---|---|
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
CreateStageChannelAsync(String, IEnumerable<DiscordOverwriteBuilder>, String)
Creates a new stage channel in this guild.
Declaration
public Task<DiscordChannel> CreateStageChannelAsync(string name, IEnumerable<DiscordOverwriteBuilder> overwrites = null, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the new stage channel. |
System.Collections.Generic.IEnumerable<DiscordOverwriteBuilder> | overwrites | Permission overwrites for this stage channel. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordChannel> | The newly-created stage channel. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageChannels. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
System.NotSupportedException | Thrown when the guilds has not enabled community. |
CreateStickerAsync(String, String, DiscordEmoji, Stream, StickerFormat, String)
Creates a sticker
Declaration
public Task<DiscordSticker> CreateStickerAsync(string name, string description, DiscordEmoji emoji, Stream file, StickerFormat format, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the sticker. |
System.String | description | The optional description of the sticker. |
DiscordEmoji | emoji | The emoji to associate the sticker with. |
System.IO.Stream | file | The sticker. |
StickerFormat | format | The file format the sticker is written in. |
System.String | reason | Audit log reason |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordSticker> |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageEmojisAndStickers permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
CreateTemplateAsync(String, String)
Creates a guild template.
Declaration
public Task<DiscordGuildTemplate> CreateTemplateAsync(string name, string description = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the template. |
System.String | description | Description of the template. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuildTemplate> | The template created. |
Exceptions
Type | Condition |
---|---|
BadRequestException | Throws when a template already exists for the guild or a null parameter is provided for the name. |
UnauthorizedException | Throws when the client does not have the ManageGuild permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
CreateTextChannelAsync(String, DiscordChannel, Optional<String>, IEnumerable<DiscordOverwriteBuilder>, Nullable<Boolean>, Optional<Nullable<Int32>>, ThreadAutoArchiveDuration, String)
Creates a new text channel in this guild.
Declaration
public Task<DiscordChannel> CreateTextChannelAsync(string name, DiscordChannel parent = null, Optional<string> topic = default(Optional<string>), IEnumerable<DiscordOverwriteBuilder> overwrites = null, bool? nsfw = null, Optional<int?> perUserRateLimit = default(Optional<int?>), ThreadAutoArchiveDuration defaultAutoArchiveDuration = ThreadAutoArchiveDuration.OneDay, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the new channel. |
DiscordChannel | parent | Category to put this channel in. |
Optional<System.String> | topic | Topic of the channel. |
System.Collections.Generic.IEnumerable<DiscordOverwriteBuilder> | overwrites | Permission overwrites for this channel. |
System.Nullable<System.Boolean> | nsfw | Whether the channel is to be flagged as not safe for work. |
Optional<System.Nullable<System.Int32>> | perUserRateLimit | Slow mode timeout for users. |
ThreadAutoArchiveDuration | defaultAutoArchiveDuration | The default auto archive duration for new threads. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordChannel> | The newly-created channel. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageChannels permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
CreateVoiceChannelAsync(String, DiscordChannel, Nullable<Int32>, Nullable<Int32>, IEnumerable<DiscordOverwriteBuilder>, Nullable<VideoQualityMode>, String)
Creates a new voice channel in this guild.
Declaration
public Task<DiscordChannel> CreateVoiceChannelAsync(string name, DiscordChannel parent = null, int? bitrate = null, int? userLimit = null, IEnumerable<DiscordOverwriteBuilder> overwrites = null, VideoQualityMode? qualityMode = null, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the new channel. |
DiscordChannel | parent | Category to put this channel in. |
System.Nullable<System.Int32> | bitrate | Bitrate of the channel. |
System.Nullable<System.Int32> | userLimit | Maximum number of users in the channel. |
System.Collections.Generic.IEnumerable<DiscordOverwriteBuilder> | overwrites | Permission overwrites for this channel. |
System.Nullable<VideoQualityMode> | qualityMode | Video quality mode of the channel. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordChannel> | The newly-created channel. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageChannels permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
DeleteAllChannelsAsync()
Deletes all channels in this guild.
Note that this is irreversible. Use carefully!
Declaration
public Task DeleteAllChannelsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
DeleteAsync()
Deletes this guild. Requires the caller to be the owner of the guild.
Declaration
public Task DeleteAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client is not the owner of the guild. |
ServerErrorException | Thrown when Discord is unable to process the request. |
DeleteEmojiAsync(DiscordGuildEmoji, String)
Deletes this guild's custom emoji.
Declaration
public Task DeleteEmojiAsync(DiscordGuildEmoji emoji, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
DiscordGuildEmoji | emoji | Emoji to delete. |
System.String | reason | Reason for audit log. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageEmojisAndStickers permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
DeleteIntegrationAsync(DiscordIntegration)
Removes an integration from this guild.
Declaration
public Task DeleteIntegrationAsync(DiscordIntegration integration)
Parameters
Type | Name | Description |
---|---|---|
DiscordIntegration | integration | Integration to remove. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageGuild permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
DeleteStickerAsync(DiscordSticker, String)
Deletes a sticker
Declaration
public Task DeleteStickerAsync(DiscordSticker sticker, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
DiscordSticker | sticker | Sticker to delete |
System.String | reason | Audit log reason |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the sticker could not be found. |
UnauthorizedException | Thrown when the client does not have the ManageEmojisAndStickers permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
System.ArgumentException | Sticker does not belong to a guild. |
DeleteStickerAsync(UInt64, String)
Deletes a sticker
Declaration
public Task DeleteStickerAsync(ulong sticker, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | sticker | Id of sticker to delete |
System.String | reason | Audit log reason |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the sticker could not be found. |
UnauthorizedException | Thrown when the client does not have the ManageEmojisAndStickers permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
System.ArgumentException | Sticker does not belong to a guild. |
DeleteTemplateAsync(String)
Deletes the template.
Declaration
public Task<DiscordGuildTemplate> DeleteTemplateAsync(string code)
Parameters
Type | Name | Description |
---|---|---|
System.String | code | The code of the template to delete. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuildTemplate> | The deleted template. |
Exceptions
Type | Condition |
---|---|
NotFoundException | Throws when the template for the code cannot be found |
UnauthorizedException | Throws when the client does not have the ManageGuild permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
DisableMfaAsync(String)
Disables the mfa requirement for this guild.
Declaration
public Task DisableMfaAsync(string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | reason | The audit log reason. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the current user is not the guilds owner. |
NotFoundException | Thrown when the guild does not exist. |
ServerErrorException | Thrown when Discord is unable to process the request. |
EditApplicationCommandAsync(UInt64, Action<ApplicationCommandEditModel>)
Edits a application command in this guild.
Declaration
public async Task<DiscordApplicationCommand> EditApplicationCommandAsync(ulong commandId, Action<ApplicationCommandEditModel> action)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | commandId | The id of the command to edit. |
System.Action<ApplicationCommandEditModel> | action | Action to perform. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordApplicationCommand> | The edit command. |
EnableMfaAsync(String)
Enables the mfa requirement for this guild.
Declaration
public Task EnableMfaAsync(string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | reason | The audit log reason. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the current user is not the guilds owner. |
NotFoundException | Thrown when the guild does not exist. |
ServerErrorException | Thrown when Discord is unable to process the request. |
Equals(DiscordGuild)
Checks whether this DiscordGuild is equal to another DiscordGuild.
Declaration
public bool Equals(DiscordGuild e)
Parameters
Type | Name | Description |
---|---|---|
DiscordGuild | e | DiscordGuild to compare to. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the DiscordGuild is equal to this DiscordGuild. |
Equals(Object)
Checks whether this DiscordGuild is equal to another object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Object to compare to. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the object is equal to this DiscordGuild. |
Overrides
GetActiveThreadsAsync()
Gets active threads. Can contain more threads. If the result's value 'HasMore' is true, you need to recall this function to get older threads.
Declaration
public Task<DiscordThreadResult> GetActiveThreadsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordThreadResult> |
Exceptions
Type | Condition |
---|---|
NotFoundException | Thrown when the thread does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetAllMembersAsync()
Retrieves a full list of members from Discord. This method will bypass cache.
Declaration
public async Task<IReadOnlyCollection<DiscordMember>> GetAllMembersAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<DiscordMember>> | A collection of all members in this guild. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetApplicationCommandsAsync()
Gets all the application commands in this guild.
Declaration
public Task<IReadOnlyList<DiscordApplicationCommand>> GetApplicationCommandsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordApplicationCommand>> | A list of application commands in this guild. |
GetAuditLogsAsync(Nullable<Int32>, DiscordMember, Nullable<AuditLogActionType>)
Gets audit log entries for this guild.
Declaration
public async Task<IReadOnlyList<DiscordAuditLogEntry>> GetAuditLogsAsync(int? limit = null, DiscordMember byMember = null, AuditLogActionType? actionType = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | limit | Maximum number of entries to fetch. |
DiscordMember | byMember | Filter by member responsible. |
System.Nullable<AuditLogActionType> | actionType | Filter by action type. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordAuditLogEntry>> | A collection of requested audit log entries. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ViewAuditLog permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetBanAsync(DiscordUser)
Gets a ban for a specific user.
Declaration
public Task<DiscordBan> GetBanAsync(DiscordUser user)
Parameters
Type | Name | Description |
---|---|---|
DiscordUser | user | The user to get the ban for. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordBan> | The requested ban object. |
Exceptions
Type | Condition |
---|---|
NotFoundException | Thrown when the specified user is not banned. |
GetBanAsync(UInt64)
Gets a ban for a specific user.
Declaration
public Task<DiscordBan> GetBanAsync(ulong userId)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | userId | The Id of the user to get the ban for. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordBan> | The requested ban object. |
Exceptions
Type | Condition |
---|---|
NotFoundException | Thrown when the specified user is not banned. |
GetBansAsync(Nullable<Int32>, Nullable<UInt64>, Nullable<UInt64>)
Gets the bans for this guild, allowing for pagination.
Declaration
public Task<IReadOnlyList<DiscordBan>> GetBansAsync(int? limit = null, ulong? before = null, ulong? after = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | limit | Maximum number of bans to fetch. Max 1000. Defaults to 1000. |
System.Nullable<System.UInt64> | before | The Id of the user before which to fetch the bans. Overrides |
System.Nullable<System.UInt64> | after | The Id of the user after which to fetch the bans. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordBan>> | Collection of bans in this guild in ascending order by user id. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the BanMembers permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetChannel(UInt64)
Gets a channel from this guild by its ID.
Declaration
public DiscordChannel GetChannel(ulong id)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | id | ID of the channel to get. |
Returns
Type | Description |
---|---|
DiscordChannel | Requested channel. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetChannelsAsync()
Gets all the channels this guild has.
Declaration
public Task<IReadOnlyList<DiscordChannel>> GetChannelsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordChannel>> | A collection of this guild's channels. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetDefaultChannel()
Gets the default channel for this guild.
Default channel is the first channel current member can see.
Declaration
public DiscordChannel GetDefaultChannel()
Returns
Type | Description |
---|---|
DiscordChannel | This member's default guild. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetEmojiAsync(UInt64)
Gets this guild's specified custom emoji.
Declaration
public Task<DiscordGuildEmoji> GetEmojiAsync(ulong id)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | id | ID of the emoji to get. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuildEmoji> | The requested custom emoji. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetEmojisAsync()
Gets all of this guild's custom emojis.
Declaration
public Task<IReadOnlyList<DiscordGuildEmoji>> GetEmojisAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordGuildEmoji>> | All of this guild's custom emojis. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetHashCode()
Gets the hash code for this DiscordGuild.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | The hash code for this DiscordGuild. |
Overrides
GetIntegrationsAsync()
Gets integrations attached to this guild.
Declaration
public Task<IReadOnlyList<DiscordIntegration>> GetIntegrationsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordIntegration>> | Collection of integrations attached to this guild. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageGuild permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetInvite(String)
Gets an invite from this guild from an invite code.
Declaration
public DiscordInvite GetInvite(string code)
Parameters
Type | Name | Description |
---|---|---|
System.String | code | The invite code |
Returns
Type | Description |
---|---|
DiscordInvite | An invite, or null if not in cache. |
GetInvitesAsync()
Gets all the invites created for all the channels in this guild.
Declaration
public async Task<IReadOnlyList<DiscordInvite>> GetInvitesAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordInvite>> | A collection of invites. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetMemberAsync(UInt64)
Gets a member of this guild by their user ID.
Declaration
public async Task<DiscordMember> GetMemberAsync(ulong userId)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | userId | ID of the member to get. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordMember> | The requested member. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetMembershipScreeningFormAsync()
Gets this guild's membership screening form.
Declaration
public Task<DiscordGuildMembershipScreening> GetMembershipScreeningFormAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuildMembershipScreening> | This guild's membership screening form. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetOrderedChannels()
Gets an ordered DiscordChannel list out of the channel cache. Returns a Dictionary where the key is an ulong and can be mapped to Category DiscordChannels. Ignore the 0 key here, because that indicates that this is the "has no category" list. Each value contains a ordered list of text/news and voice/stage channels as DiscordChannel.
Declaration
public Dictionary<ulong, List<DiscordChannel>> GetOrderedChannels()
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.UInt64, System.Collections.Generic.List<DiscordChannel>> | A ordered list of categories with its channels |
GetOrderedChannelsAsync()
Gets an ordered DiscordChannel list. Returns a Dictionary where the key is an ulong and can be mapped to Category DiscordChannels. Ignore the 0 key here, because that indicates that this is the "has no category" list. Each value contains a ordered list of text/news and voice/stage channels as DiscordChannel.
Declaration
public async Task<Dictionary<ulong, List<DiscordChannel>>> GetOrderedChannelsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<System.UInt64, System.Collections.Generic.List<DiscordChannel>>> | A ordered list of categories with its channels |
GetPruneCountAsync(Int32, IEnumerable<DiscordRole>)
Estimates the number of users to be pruned.
Declaration
public Task<int> GetPruneCountAsync(int days = 7, IEnumerable<DiscordRole> includedRoles = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | days | Minimum number of inactivity days required for users to be pruned. Defaults to 7. |
System.Collections.Generic.IEnumerable<DiscordRole> | includedRoles | The roles to be included in the prune. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | Number of users that will be pruned. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the KickMembers permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetRole(UInt64)
Gets a role from this guild by its ID.
Declaration
public DiscordRole GetRole(ulong id)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | id | ID of the role to get. |
Returns
Type | Description |
---|---|
DiscordRole | Requested role. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetScheduledEventAsync(DiscordScheduledEvent, Nullable<Boolean>)
Gets a specific scheduled events.
Declaration
public async Task<DiscordScheduledEvent> GetScheduledEventAsync(DiscordScheduledEvent scheduledEvent, bool? withUserCount = null)
Parameters
Type | Name | Description |
---|---|---|
DiscordScheduledEvent | scheduledEvent | The event to get. |
System.Nullable<System.Boolean> | withUserCount | Whether to include user count. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordScheduledEvent> | A scheduled event. |
Exceptions
Type | Condition |
---|---|
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetScheduledEventAsync(UInt64, Nullable<Boolean>)
Gets a specific scheduled events.
Declaration
public async Task<DiscordScheduledEvent> GetScheduledEventAsync(ulong scheduledEventId, bool? withUserCount = null)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | scheduledEventId | The Id of the event to get. |
System.Nullable<System.Boolean> | withUserCount | Whether to include user count. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordScheduledEvent> | A scheduled event. |
Exceptions
Type | Condition |
---|---|
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetScheduledEventsAsync(Nullable<Boolean>)
Gets the guilds scheduled events.
Declaration
public async Task<IReadOnlyDictionary<ulong, DiscordScheduledEvent>> GetScheduledEventsAsync(bool? withUserCount = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Boolean> | withUserCount | Whether to include user count. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyDictionary<System.UInt64, DiscordScheduledEvent>> | A list of the guilds scheduled events. |
Exceptions
Type | Condition |
---|---|
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetStickerAsync(UInt64)
Gets a sticker
Declaration
public Task<DiscordSticker> GetStickerAsync(ulong stickerId)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | stickerId |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordSticker> |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the sticker could not be found. |
UnauthorizedException | Thrown when the client does not have the ManageEmojisAndStickers permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
System.ArgumentException | Sticker does not belong to a guild. |
GetStickersAsync()
Gets all of this guild's custom stickers.
Declaration
public async Task<IReadOnlyList<DiscordSticker>> GetStickersAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordSticker>> | All of this guild's custom stickers. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetTemplatesAsync()
Gets all of this guild's templates.
Declaration
public Task<IReadOnlyList<DiscordGuildTemplate>> GetTemplatesAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordGuildTemplate>> | All of the guild's templates. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Throws when the client does not have the ManageGuild permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetThread(UInt64)
Gets a thread from this guild by its ID.
Declaration
public DiscordThreadChannel GetThread(ulong id)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | id | ID of the thread to get. |
Returns
Type | Description |
---|---|
DiscordThreadChannel | Requested thread. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetVanityInviteAsync()
Gets the vanity invite for this guild.
Declaration
public Task<DiscordInvite> GetVanityInviteAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordInvite> | A partial vanity invite. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageGuild permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetWebhooksAsync()
Gets all the webhooks created for all the channels in this guild.
Declaration
public Task<IReadOnlyList<DiscordWebhook>> GetWebhooksAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordWebhook>> | A collection of webhooks this guild has. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageWebhooks permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetWelcomeScreenAsync()
Gets this guild's welcome screen.
Declaration
public Task<DiscordGuildWelcomeScreen> GetWelcomeScreenAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuildWelcomeScreen> | This guild's welcome screen object. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
GetWidgetAsync()
Gets the guild's widget
Declaration
public Task<DiscordWidget> GetWidgetAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordWidget> | The guild's widget |
GetWidgetImage(WidgetType)
Gets this guild's widget image.
Declaration
public string GetWidgetImage(WidgetType bannerType = WidgetType.Shield)
Parameters
Type | Name | Description |
---|---|---|
WidgetType | bannerType | The format of the widget. |
Returns
Type | Description |
---|---|
System.String | The URL of the widget image. |
GetWidgetSettingsAsync()
Gets the guild's widget settings
Declaration
public Task<DiscordWidgetSettings> GetWidgetSettingsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordWidgetSettings> | The guild's widget settings |
LeaveAsync()
Leaves this guild.
Declaration
public Task LeaveAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
ListVoiceRegionsAsync()
Gets the voice regions for this guild.
Declaration
public async Task<IReadOnlyList<DiscordVoiceRegion>> ListVoiceRegionsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordVoiceRegion>> | Voice regions available for this guild. |
Exceptions
Type | Condition |
---|---|
ServerErrorException | Thrown when Discord is unable to process the request. |
ModifyAsync(Action<GuildEditModel>)
Modifies this guild.
Declaration
public async Task<DiscordGuild> ModifyAsync(Action<GuildEditModel> action)
Parameters
Type | Name | Description |
---|---|---|
System.Action<GuildEditModel> | action | Action to perform on this guild. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuild> | The modified guild object. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageGuild permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
ModifyCommunitySettingsAsync(Boolean, DiscordChannel, DiscordChannel, String, String, DefaultMessageNotifications, String)
Modifies the community settings async. This sets High if not highest and AllMembers.
Declaration
public async Task<DiscordGuild> ModifyCommunitySettingsAsync(bool enabled, DiscordChannel rulesChannel = null, DiscordChannel publicUpdatesChannel = null, string preferredLocale = "en-US", string description = null, DefaultMessageNotifications defaultMessageNotifications = DefaultMessageNotifications.MentionsOnly, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | enabled | If true, enable HasCommunityEnabled. |
DiscordChannel | rulesChannel | The rules channel. |
DiscordChannel | publicUpdatesChannel | The public updates channel. |
System.String | preferredLocale | The preferred locale. Defaults to en-US. |
System.String | description | The description. |
DefaultMessageNotifications | defaultMessageNotifications | The default message notifications. Defaults to MentionsOnly |
System.String | reason | The audit log reason. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuild> |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageGuild permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
ModifyEmojiAsync(DiscordGuildEmoji, String, IEnumerable<DiscordRole>, String)
Modifies a this guild's custom emoji.
Declaration
public Task<DiscordGuildEmoji> ModifyEmojiAsync(DiscordGuildEmoji emoji, string name, IEnumerable<DiscordRole> roles = null, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
DiscordGuildEmoji | emoji | Emoji to modify. |
System.String | name | New name for the emoji. |
System.Collections.Generic.IEnumerable<DiscordRole> | roles | Roles for which the emoji will be available. This works only if your application is whitelisted as integration. |
System.String | reason | Reason for audit log. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuildEmoji> | The modified emoji. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageEmojisAndStickers permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
ModifyIntegrationAsync(DiscordIntegration, Int32, Int32, Boolean)
Modifies an integration in this guild.
Declaration
public Task<DiscordIntegration> ModifyIntegrationAsync(DiscordIntegration integration, int expireBehaviour, int expireGracePeriod, bool enableEmoticons)
Parameters
Type | Name | Description |
---|---|---|
DiscordIntegration | integration | Integration to modify. |
System.Int32 | expireBehaviour | Number of days after which the integration expires. |
System.Int32 | expireGracePeriod | Length of grace period which allows for renewing the integration. |
System.Boolean | enableEmoticons | Whether emotes should be synced from this integration. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordIntegration> | The modified integration. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageGuild permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
ModifyMembershipScreeningFormAsync(Action<MembershipScreeningEditModel>)
Modifies this guild's membership screening form.
Declaration
public async Task<DiscordGuildMembershipScreening> ModifyMembershipScreeningFormAsync(Action<MembershipScreeningEditModel> action)
Parameters
Type | Name | Description |
---|---|---|
System.Action<MembershipScreeningEditModel> | action | Action to perform |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuildMembershipScreening> | The modified screening form. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client doesn't have the ManageGuild permission, or community is not enabled on this guild. |
ServerErrorException | Thrown when Discord is unable to process the request. |
ModifyStickerAsync(DiscordSticker, Optional<String>, Optional<String>, Optional<DiscordEmoji>, String)
Modifies a sticker
Declaration
public Task<DiscordSticker> ModifyStickerAsync(DiscordSticker sticker, Optional<string> name, Optional<string> description, Optional<DiscordEmoji> emoji, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
DiscordSticker | sticker | The sticker to modify |
Optional<System.String> | name | The name of the sticker |
Optional<System.String> | description | The description of the sticker |
Optional<DiscordEmoji> | emoji | The emoji to associate with this sticker. |
System.String | reason | Audit log reason |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordSticker> | A sticker object |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the sticker could not be found. |
UnauthorizedException | Thrown when the client does not have the ManageEmojisAndStickers permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
System.ArgumentException | Sticker does not belong to a guild. |
ModifyStickerAsync(UInt64, Optional<String>, Optional<String>, Optional<DiscordEmoji>, String)
Modifies a sticker
Declaration
public async Task<DiscordSticker> ModifyStickerAsync(ulong sticker, Optional<string> name, Optional<string> description, Optional<DiscordEmoji> emoji, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | sticker | The id of the sticker to modify |
Optional<System.String> | name | The name of the sticker |
Optional<System.String> | description | The description of the sticker |
Optional<DiscordEmoji> | emoji | The emoji to associate with this sticker. |
System.String | reason | Audit log reason |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordSticker> | A sticker object |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the sticker could not be found. |
UnauthorizedException | Thrown when the client does not have the ManageEmojisAndStickers permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
System.ArgumentException | Sticker does not belong to a guild. |
ModifyTemplateAsync(String, String, String)
Modifies the template's metadata.
Declaration
public Task<DiscordGuildTemplate> ModifyTemplateAsync(string code, string name = null, string description = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | code | The template's code. |
System.String | name | Name of the template. |
System.String | description | Description of the template. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuildTemplate> | The template modified. |
Exceptions
Type | Condition |
---|---|
NotFoundException | Throws when the template for the code cannot be found |
UnauthorizedException | Throws when the client does not have the ManageGuild permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
ModifyWelcomeScreenAsync(Action<WelcomeScreenEditModel>)
Modifies this guild's welcome screen.
Declaration
public async Task<DiscordGuildWelcomeScreen> ModifyWelcomeScreenAsync(Action<WelcomeScreenEditModel> action)
Parameters
Type | Name | Description |
---|---|---|
System.Action<WelcomeScreenEditModel> | action | Action to perform. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuildWelcomeScreen> | The modified welcome screen. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client doesn't have the ManageGuild permission, or community is not enabled on this guild. |
ServerErrorException | Thrown when Discord is unable to process the request. |
ModifyWidgetSettingsAsync(Nullable<Boolean>, DiscordChannel, String)
Modifies the guild's widget settings
Declaration
public Task<DiscordWidgetSettings> ModifyWidgetSettingsAsync(bool? isEnabled = null, DiscordChannel channel = null, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Boolean> | isEnabled | If the widget is enabled or not |
DiscordChannel | channel | Widget channel |
System.String | reason | Reason the widget settings were modified |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordWidgetSettings> | The newly modified widget settings |
PruneAsync(Int32, Boolean, IEnumerable<DiscordRole>, String)
Prunes inactive users from this guild.
Declaration
public Task<int?> PruneAsync(int days = 7, bool computePruneCount = true, IEnumerable<DiscordRole> includedRoles = null, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | days | Minimum number of inactivity days required for users to be pruned. Defaults to 7. |
System.Boolean | computePruneCount | Whether to return the prune count after this method completes. This is discouraged for larger guilds. |
System.Collections.Generic.IEnumerable<DiscordRole> | includedRoles | The roles to be included in the prune. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Nullable<System.Int32>> | Number of users pruned. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageChannels permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
RemoveTimeoutAsync(UInt64, String)
Removes the timeout from a specified member in this guild.
Declaration
public Task RemoveTimeoutAsync(ulong memberId, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | memberId | Member to remove the timeout from. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ModerateMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
RequestMembersAsync(String, Int32, Nullable<Boolean>, IEnumerable<UInt64>, String)
Requests that Discord send a list of guild members based on the specified arguments. This method will fire the GuildMembersChunked event.
If no arguments aside from presences
and nonce
are specified, this will request all guild members.
Declaration
public async Task RequestMembersAsync(string query = "", int limit = 0, bool? presences = null, IEnumerable<ulong> userIds = null, string nonce = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | query | Filters the returned members based on what the username starts with. Either this or |
System.Int32 | limit | Total number of members to request. This must be greater than 0 if |
System.Nullable<System.Boolean> | presences | Whether to include the Presences associated with the fetched members. |
System.Collections.Generic.IEnumerable<System.UInt64> | userIds | Whether to limit the request to the specified user ids. Either this or |
System.String | nonce | The unique string to identify the response. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SearchMembersAsync(String, Nullable<Int32>)
Searches the current guild for members who's display name start with the specified name.
Declaration
public Task<IReadOnlyList<DiscordMember>> SearchMembersAsync(string name, int? limit = 1)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name to search for. |
System.Nullable<System.Int32> | limit | The maximum amount of members to return. Max 1000. Defaults to 1. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<DiscordMember>> | The members found, if any. |
SyncIntegrationAsync(DiscordIntegration)
Forces re-synchronization of an integration for this guild.
Declaration
public Task SyncIntegrationAsync(DiscordIntegration integration)
Parameters
Type | Name | Description |
---|---|---|
DiscordIntegration | integration | Integration to synchronize. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageGuild permission. |
NotFoundException | Thrown when the guild does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
SyncTemplateAsync(String)
Syncs the template to the current guild's state.
Declaration
public Task<DiscordGuildTemplate> SyncTemplateAsync(string code)
Parameters
Type | Name | Description |
---|---|---|
System.String | code | The code of the template to sync. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordGuildTemplate> | The template synced. |
Exceptions
Type | Condition |
---|---|
NotFoundException | Throws when the template for the code cannot be found |
UnauthorizedException | Throws when the client does not have the ManageGuild permission. |
ServerErrorException | Thrown when Discord is unable to process the request. |
TimeoutAsync(UInt64, DateTime, String)
Timeout a specified member in this guild.
Declaration
public Task TimeoutAsync(ulong memberId, DateTime until, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | memberId | Member to timeout. |
System.DateTime | until | The datetime to time out the user. Up to 28 days. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ModerateMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
TimeoutAsync(UInt64, DateTimeOffset, String)
Timeout a specified member in this guild.
Declaration
public Task TimeoutAsync(ulong memberId, DateTimeOffset until, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | memberId | Member to timeout. |
System.DateTimeOffset | until | The datetime offset to time out the user. Up to 28 days. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ModerateMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
TimeoutAsync(UInt64, TimeSpan, String)
Timeout a specified member in this guild.
Declaration
public Task TimeoutAsync(ulong memberId, TimeSpan until, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | memberId | Member to timeout. |
System.TimeSpan | until | The timespan to time out the user. Up to 28 days. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ModerateMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
ToString()
Returns a string representation of this guild.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | String representation of this guild. |
Overrides
UnbanMemberAsync(DiscordUser, String)
Unbans a user from this guild.
Declaration
public Task UnbanMemberAsync(DiscordUser user, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
DiscordUser | user | User to unban. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the BanMembers permission. |
NotFoundException | Thrown when the user does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
UnbanMemberAsync(UInt64, String)
Unbans a user by ID.
Declaration
public Task UnbanMemberAsync(ulong userId, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | userId | ID of the user to unban. |
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the BanMembers permission. |
NotFoundException | Thrown when the user does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
Operators
| Improve this Doc View SourceEquality(DiscordGuild, DiscordGuild)
Gets whether the two DiscordGuild objects are equal.
Declaration
public static bool operator ==(DiscordGuild e1, DiscordGuild e2)
Parameters
Type | Name | Description |
---|---|---|
DiscordGuild | e1 | First guild to compare. |
DiscordGuild | e2 | Second guild to compare. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two guilds are equal. |
Inequality(DiscordGuild, DiscordGuild)
Gets whether the two DiscordGuild objects are not equal.
Declaration
public static bool operator !=(DiscordGuild e1, DiscordGuild e2)
Parameters
Type | Name | Description |
---|---|---|
DiscordGuild | e1 | First guild to compare. |
DiscordGuild | e2 | Second guild to compare. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two guilds are not equal. |