DiscordGuild

public final class DiscordGuild : DiscordClientHolder, CustomStringConvertible

Represents a Guild.

  • The guild’s features.

    Declaration

    Swift

    public let features: [Any]
  • id

    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: String

    Return Value

    A description of this guild

  • A DiscordLazyDictionary of 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 members field.

    Declaration

    Swift

    public internal(set) var memberCount: Int
  • A DiscordLazyDictionary of 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

    member

    The member to ban.

    deleteMessageDays

    The number of days going back to delete messages. Defaults to 7.

    reason

    The 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

    with

    The options for this new channel

    reason

    The 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

    withOptions

    The options to use when getting the logs.

    callback

    The callback.

  • Gets the bans for this guild.

    Declaration

    Swift

    public func getBans(callback: @escaping ([DiscordBan], HTTPURLResponse?) -> ())

    Parameters

    callback

    The callback.

  • Gets a guild member by their user id.

    Declaration

    Swift

    public func getGuildMember(_ userId: UserID, callback: @escaping (DiscordGuildMember?, HTTPURLResponse?) -> ())

    Parameters

    userId

    The 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

    options

    An array of options to change.

    reason

    The reason for this change.

  • Modifies a guild member.

    Declaration

    Swift

    public func modifyMember(_ member: DiscordGuildMember, options: [DiscordEndpoint.Options.ModifyMember])

    Parameters

    member

    The member to modify.

    options

    The options to set.

  • Gets the roles that this member has on this guild.

    Declaration

    Swift

    public func roles(for member: DiscordGuildMember) -> [DiscordRole]

    Parameters

    member

    The 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

    user

    The user to unban