DiscordGuild
public final class DiscordGuild : DiscordClientHolder, CustomStringConvertible
Represents a Guild.
-
The guild’s features.
Declaration
Swift
public let features: [Any] -
The snowflake id of the guild.
Declaration
Swift
public let id: GuildID -
Whether or not this a
large
guild.Declaration
Swift
public let large: Bool -
The date the user joined the guild.
Declaration
Swift
public let joinedAt: Date -
The base64 encoded splash image.
Declaration
Swift
public let splash: String -
Whether this guild is unavailable.
Declaration
Swift
public let unavailable: Bool -
Declaration
Swift
public var description: StringReturn Value
A description of this guild
-
A
DiscordLazyDictionaryof guild members. The key is the snowflake id of the user.Declaration
Swift
public var members = DiscordLazyDictionary<UserID, DiscordGuildMember>() -
Reference to the client.
Declaration
Swift
public weak var client: DiscordClient? -
A dictionary of this guild’s channels. The key is the snowflake id of the channel.
Declaration
Swift
public internal(set) var channels: [ChannelID: DiscordGuildChannel] -
A dictionary of this guild’s emojis. The key is the snowflake id of the emoji.
Declaration
Swift
public internal(set) var emojis: [EmojiID: DiscordEmoji] -
The number of members in this guild.
This number might not be the actual number of users in the
membersfield.Declaration
Swift
public internal(set) var memberCount: Int -
A
DiscordLazyDictionaryof presences. The key is the snowflake id of the user.Declaration
Swift
public internal(set) var presences = DiscordLazyDictionary<UserID, DiscordPresence>() -
A dictionary of this guild’s roles. The key is the snowflake id of the role.
Declaration
Swift
public internal(set) var roles: [RoleID: DiscordRole] -
A dictionary of this guild’s current voice states. The key is the snowflake id of the user for this voice state.
Declaration
Swift
public internal(set) var voiceStates: [UserID: DiscordVoiceState] -
The default message notification setting.
Declaration
Swift
public private(set) var defaultMessageNotifications: Int -
The snowflake id of the embed channel for this guild.
Declaration
Swift
public private(set) var embedChannelId: ChannelID -
Whether this guild has embed enabled.
Declaration
Swift
public private(set) var embedEnabled: Bool -
The base64 encoded icon image for this guild.
Declaration
Swift
public private(set) var icon: String -
The multi-factor authentication level for this guild.
Declaration
Swift
public private(set) var mfaLevel: Int -
The name of this guild.
Declaration
Swift
public private(set) var name: String -
The snowflake id of this guild’s owner.
Declaration
Swift
public private(set) var ownerId: UserID -
The region this guild is in.
Declaration
Swift
public private(set) var region: String -
The verification level a member of this guild must have to join.
Declaration
Swift
public private(set) var verificationLevel: Int
-
Bans this user from the guild.
Declaration
Swift
public func ban(_ member: DiscordGuildMember, deleteMessageDays: Int = 7, reason: String? = nil)Parameters
memberThe member to ban.
deleteMessageDaysThe number of days going back to delete messages. Defaults to 7.
reasonThe reason for this ban.
-
Creates a channel on this guild with
options. The channel will not be immediately available; wait for a channel create event.Declaration
Swift
public func createChannel(with options: [DiscordEndpoint.Options.GuildCreateChannel], reason: String? = nil)Parameters
withThe options for this new channel
reasonThe reason this channel is being created.
-
Gets the audit log for this guild.
Declaration
Swift
public func getAuditLog(withOptions options: [DiscordEndpoint.Options.AuditLog] = [], callback: @escaping (DiscordAuditLog?, HTTPURLResponse?) -> ())Parameters
withOptionsThe options to use when getting the logs.
callbackThe callback.
-
Gets the bans for this guild.
Declaration
Swift
public func getBans(callback: @escaping ([DiscordBan], HTTPURLResponse?) -> ())Parameters
callbackThe callback.
-
Gets a guild member by their user id.
Declaration
Swift
public func getGuildMember(_ userId: UserID, callback: @escaping (DiscordGuildMember?, HTTPURLResponse?) -> ())Parameters
userIdThe user id of the member to get
-
Modifies this guild with
options.Declaration
Swift
public func modifyGuild(options: [DiscordEndpoint.Options.ModifyGuild], reason: String? = nil)Parameters
optionsAn array of options to change.
reasonThe reason for this change.
-
Modifies a guild member.
Declaration
Swift
public func modifyMember(_ member: DiscordGuildMember, options: [DiscordEndpoint.Options.ModifyMember])Parameters
memberThe member to modify.
optionsThe options to set.
-
Gets the roles that this member has on this guild.
Declaration
Swift
public func roles(for member: DiscordGuildMember) -> [DiscordRole]Parameters
memberThe member whose roles we are getting.
Return Value
An array containing the roles they have.
-
Unbans the specified user from the guild.
Declaration
Swift
public func unban(_ user: DiscordUser)Parameters
userThe user to unban
DiscordGuild Class Reference