Webhook

public struct Webhook

Webhook structure

  • Parent class

    Declaration

    Swift

    public internal(set) weak var sword: Sword?
  • Avatar for the webhook in base64

    Declaration

    Swift

    public let avatar: String?
  • The GuildText this webhook messages to

    Declaration

    Swift

    public let channel: GuildText
  • The Guild this webhook is located in

    Declaration

    Swift

    public internal(set) weak var guild: Guild?
  • id

    The id of the webhook

    Declaration

    Swift

    public let id: Snowflake
  • The display name of the webhook

    Declaration

    Swift

    public let name: String
  • The user account for this webhook

    Declaration

    Swift

    public let user: User?
  • The token for this webhook

    Declaration

    Swift

    public let token: String
  • Deletes the current webhook from its guild

    Declaration

    Swift

    public func delete(then completion: @escaping (RequestError?) -> () = {_ in})
  • Executes a webhook

    Content Dictionary Params

    • content: Message to send
    • username: The username the webhook will send with the message
    • avatar_url: The url of the user the webhook will send
    • tts: Whether or not this message is tts
    • file: The url of the image to send
    • embed: The embed object to send. Refer to Embed structure

    Declaration

    Swift

    public func execute(
        with content: Any,
        then completion: ((RequestError?) -> ())? = nil
      )
  • Executs a slack style webhook

    Content Params

    Refer to the slack documentation for their webhook structure

    Declaration

    Swift

    public func executeSlack(
        with content: [String: Any],
        then completion: ((RequestError?) -> ())? = nil
      )
  • Modifies the current Webhook

    Option Params

    • name: The name of the webhook
    • avatar: The avatar for this webhook in base64 string

    Declaration

    Swift

    public func modify(
        with options: [String: String],
        then completion: ((Webhook?, RequestError?) -> ())? = nil
      )