DiscordToken

public struct DiscordToken : ExpressibleByStringLiteral, CustomStringConvertible

A type that represents a Discord JWT.

This type conforms to ExpressibleByStringLiteral so it can be created via string literals.

For example:

let token = "Bot adfadf.adfdafdafdfa.afdaf" as DiscordToken

The Bot prefix indicates that this token is a bot. This must included if the token is for a bot. Likewise, if the token is an OAuth token, it must be preceded by Bearer. User tokens can omit a prefix.

  • ExpressibleByStringLiteral conformance

    Declaration

    Swift

    public typealias StringLiteralType = String
  • ExpressibleByStringLiteral conformance.

    Declaration

    Swift

    public typealias ExtendedGraphemeClusterLiteralType = String.ExtendedGraphemeClusterLiteralType
  • ExpressibleByStringLiteral conformance.

    Declaration

    Swift

    public typealias UnicodeScalarLiteralType = String.UnicodeScalarLiteralType
  • The token string.

    Declaration

    Swift

    public let token: String
  • CustomStringConvertible conformance. Same as token.

    Declaration

    Swift

    public var description: String
  • Whether this token is a bot token.

    Declaration

    Swift

    public var isBot: Bool
  • Whether this token is an OAuth token.

    Declaration

    Swift

    public var isBearer: Bool
  • Whether this token is a user token.

    Declaration

    Swift

    public var isUser: Bool