Guild

public class Guild: Updatable

Guild Type

  • Parent class

    Declaration

    Swift

    public internal(set) weak var sword: Sword?
  • ID of afk voice channel (if there is any)

    Declaration

    Swift

    public internal(set) var afkChannelId: Snowflake?
  • AFK timeout in seconds (if there is any)

    Declaration

    Swift

    public internal(set) var afkTimeout: Int?
  • Collection of channels mapped by channel ID

    Declaration

    Swift

    public internal(set) var channels = [Snowflake: GuildChannel]()
  • Default notification protocol

    Declaration

    Swift

    public internal(set) var defaultMessageNotifications: Int
  • ID of embeddable channel

    Declaration

    Swift

    public internal(set) var embedChannelId: Snowflake?
  • Array of custom emojis for this guild

    Declaration

    Swift

    public internal(set) var emojis = [Emoji]()
  • Array of features this guild has

    Declaration

    Swift

    public internal(set) var features = [Feature]()
  • Icon hash for guild

    Declaration

    Swift

    public internal(set) var icon: String?
  • id

    ID of guild

    Declaration

    Swift

    public let id: Snowflake
  • Whether or not this guild is embeddable

    Declaration

    Swift

    public internal(set) var isEmbedEnabled: Bool?
  • Whether or not this guild is considered large

    Declaration

    Swift

    public let isLarge: Bool?
  • The date at which the bot joined the server

    Declaration

    Swift

    public let joinedAt: Date?
  • Amount of members this guild has

    Declaration

    Swift

    public let memberCount: Int?
  • Collection of members mapped by user ID

    Declaration

    Swift

    public internal(set) var members = [Snowflake: Member]()
  • MFA level of guild

    Declaration

    Swift

    public internal(set) var mfaLevel: MFALevel
  • Name of the guild

    Declaration

    Swift

    public internal(set) var name: String
  • Owner’s user ID

    Declaration

    Swift

    public internal(set) var ownerId: Snowflake
  • Region this guild is hosted in

    Declaration

    Swift

    public internal(set) var region: String
  • Collection of roles mapped by role ID

    Declaration

    Swift

    public internal(set) var roles = [Snowflake: Role]()
  • Shard ID this guild is handled by

    Declaration

    Swift

    public let shard: Int?
  • Splash Hash for guild

    Declaration

    Swift

    public internal(set) var splash: String?
  • Level of verification for guild

    Declaration

    Swift

    public internal(set) var verificationLevel: VerificationLevel
  • Collection of member voice states currently in this guild

    Declaration

    Swift

    public internal(set) var voiceStates = [Snowflake: VoiceState]()
  • Bans a member from this guild

    Option Params

    • delete-message-days: Number of days to delete messages for (0-7)

    Declaration

    Swift

    public func ban(
        _ member: Snowflake,
        for reason: String? = nil,
        with options: [String: Int] = [:],
        then completion: ((RequestError?) -> ())? = nil
      )
  • Creates a channel in this guild

    Option Params

    • name: The name to give this channel
    • type: The type of channel to create
    • bitrate: If a voice channel, sets the bitrate for the voice channel
    • user_limit: If a voice channel, sets the maximum amount of users to be allowed at a time
    • permission_overwrites: Array of overwrite objects to give this channel

    Declaration

    Swift

    public func createChannel(
        with options: [String: Any],
        then completion: ((GuildChannel?, RequestError?) -> ())? = nil
      )
  • Creates an integration for this guild

    Option Params

    • type: The type of integration to create
    • id: The id of the user’s integration to link to this guild

    Declaration

    Swift

    public func createIntegration(
        with options: [String: String],
        then completion: ((RequestError?) -> ())? = nil
      )
  • Creates a guild role

    Option Params

    • name: The name of the role
    • permissions: The bitwise number to set role with
    • color: Integer value of RGB color
    • hoist: Whether or not this role is hoisted on the member list
    • mentionable: Whether or not this role is mentionable in chat

    Declaration

    Swift

    public func createRole(
        with options: [String: Any],
        then completion: ((Role?, RequestError?) -> ())? = nil
      )
  • Deletes an integration from this guild

    Declaration

    Swift

    public func deleteIntegration(
        _ integrationId: Snowflake,
        then completion: ((RequestError?) -> ())? = nil
      )
  • Deletes a role from this guild

    Declaration

    Swift

    public func deleteRole(
        _ roleId: Snowflake,
        then completion: ((Role?, RequestError?) -> ())? = nil
      )
  • Deletes current guild

    Declaration

    Swift

    public func delete(then completion: ((Guild?, RequestError?) -> ())? = nil)
  • Get’s this guild’s audit logs

    Options Params

    • user_id: String of user to look for logs of
    • action_type: Integer of Audit Log Event. Refer to Audit Log Events
    • before: String of entry id to look before
    • limit: Integer of how many entries to return (default 50, minimum 1, maximum 100)

    Declaration

    Swift

    public func getAuditLog(
        with options: [String: Any]? = nil,
        then completion: @escaping (AuditLog?, RequestError?) -> ()
      )
  • Gets guild’s bans

    Declaration

    Swift

    public func getBans(
        then completion: @escaping ([User]?, RequestError?) -> ()
      )
  • Gets the guild embed

    Declaration

    Swift

    public func getEmbed(
        then completion: @escaping ([String: Any]?, RequestError?) -> ()
      )
  • Gets guild’s integrations

    Declaration

    Swift

    public func getIntegrations(
        then completion: @escaping ([[String: Any]]?, RequestError?) -> ()
      )
  • Gets guild’s invites

    Declaration

    Swift

    public func getInvites(
        then completion: @escaping ([[String: Any]]?, RequestError?) -> ()
      )
  • Gets an array of guild members

    Option Params

    • limit: Amount of members to get (1-1000)
    • after: Message Id of highest member to get members from

    Declaration

    Swift

    public func getMembers(
        with options: [String: Any]? = nil,
        then completion: @escaping ([Member]?, RequestError?) -> ()
      )
  • Gets number of users who would be pruned by x amount of days

    Declaration

    Swift

    public func getPruneCount(
        for limit: Int,
        then completion: @escaping (Int?, RequestError?) -> ()
      )
  • Gets guild roles

    Declaration

    Swift

    public func getRoles(
        then completion: @escaping ([Role]?, RequestError?) -> ()
      )
  • Gets an array of voice regions from guild

    Declaration

    Swift

    public func getVoiceRegions(
        then completion: @escaping ([[String: Any]]?, RequestError?) -> ()
      )
  • Gets guild’s webhooks

    Declaration

    Swift

    public func getWebhooks(
        then completion: @escaping ([Webhook]?, RequestError?) -> ()
      )
  • Kicks member from this guild

    Declaration

    Swift

    public func kick(
        _ userId: Snowflake,
        for reason: String? = nil,
        then completion: ((RequestError?) -> ())? = nil
      )
  • Modifies current guild

    Options Params

    • name: The name to assign to the guild
    • region: The region to set this guild to
    • verification_level: The guild verification level integer
    • default_message_notifications: The guild default message notification settings integer
    • afk_channel_id: The channel id to assign afks
    • afk_timeout: The amount of time in seconds to afk a user in voice
    • icon: The icon in base64 string
    • owner_id: The user id to make own of this server
    • splash: If a VIP server, the splash image in base64 to assign

    Declaration

    Swift

    public func modify(
        with options: [String: Any],
        then completion: ((Guild?, RequestError?) -> ())? = nil
      )
  • Modifies channel positions

    Options Params

    Array of the following:

    • id: The channel id to modify
    • position: The sorting position of the channel

    Declaration

    Swift

    public func modifyChannelPositions(
        with options: [[String: Any]],
        then completion: (([GuildChannel]?, RequestError?) -> ())? = nil
      )
  • Modifes this guild’s Embed

    Options Params

    • enabled: Whether or not embed should be enabled
    • channel_id: Snowflake of embed channel

    Declaration

    Swift

    public func modifyEmbed(
        with options: [String: Any],
        then completion: (([String: Any]?, RequestError?) -> ())? = nil
      )
  • Modifies an integration from this guild

    Option Params

    • expire_behavior: The behavior when an integration subscription lapses (see the integration object documentation)
    • expire_grace_period: Period (in seconds) where the integration will ignore lapsed subscriptions
    • enable_emoticons: Whether emoticons should be synced for this integration (twitch only currently), true or false

    Declaration

    Swift

    public func modifyIntegration(
        _ integrationId: Snowflake,
        with options: [String: Any],
        then completion: ((RequestError?) -> ())? = nil
      )
  • Modifies a member from this guild

    Options Params

    • nick: The nickname to assign
    • roles: Array of role id’s that should be assigned to the member
    • mute: Whether or not to server mute the member
    • deaf: Whether or not to server deafen the member
    • channel_id: If the user is connected to a voice channel, assigns them the new voice channel they are to connect.

    Declaration

    Swift

    public func modifyMember(
        _ userId: Snowflake,
        with options: [String: Any],
        then completion: ((RequestError?) -> ())? = nil
      )
  • Modifies a role from this guild

    Options Params

    • name: The name to assign to the role
    • permissions: The bitwise permission integer
    • color: RGB int color value to assign to the role
    • hoist: Whether or not this role should be hoisted on the member list
    • mentionable: Whether or not this role should be mentionable by everyone

    Declaration

    Swift

    public func modifyRole(
        _ roleId: Snowflake,
        with options: [String: Any],
        then completion: ((Role?, RequestError?) -> ())? = nil
      )
  • Modifies role positions

    Options Params

    Array of the following:

    • id: The role id to edit position
    • position: The sorting position of the role

    Declaration

    Swift

    public func modifyRolePositions(
        with options: [[String: Any]],
        then completion: (([Role]?, RequestError?) -> ())? = nil
      )
  • Moves a member to another voice channel (if they are in one)

    Declaration

    Swift

    public func moveMember(
        _ userId: Snowflake,
        to channelId: Snowflake,
        then completion: ((RequestError?) -> ())? = nil
      )
  • Prunes members for x amount of days

    Declaration

    Swift

    public func pruneMembers(
        for limit: Int,
        then completion: ((Int?, RequestError?) -> ())? = nil
      )
  • Syncs an integration from this guild

    Declaration

    Swift

    public func syncIntegration(
        _ integrationId: Snowflake,
        then completion: ((RequestError?) -> ())? = nil
      )
  • Unbans a user from this guild

    Declaration

    Swift

    public func unbanMember(
        _ userId: Snowflake,
        then completion: ((RequestError?) -> ())? = nil
      )
  • Guild features

    See more

    Declaration

    Swift

    public enum Feature: String
  • Level of verification for admisitrative actions for guild

    See more

    Declaration

    Swift

    public enum MFALevel: Int
  • Level of verification for guild

    See more

    Declaration

    Swift

    public enum VerificationLevel: Int