ChatUser

open class ChatUser: CustomStringConvertible

A ChatUser represents a user on Stack Exchange chat.

  • id

    The user ID.

    Declaration

    Swift

    open let id: Int
  • Custom per-user persistent storage. Must be serializable by JSONSerialization!

    Declaration

    Swift

    open var info: [String:Any] = [:]
  • Privileges of a ChatUser. Privileges can be added by extending this struct and adding static properties.

    See more

    Declaration

    Swift

    public struct Privileges: OptionSet
  • The name of this user.

    Declaration

    Swift

    open var name: String
  • Whether this user is a ♦ moderator.

    Declaration

    Swift

    open var isMod: Bool
  • Whether this user is an owner of the room.

    Declaration

    Swift

    open var isRO: Bool
  • Whether this user is an owner of the room.

    Declaration

    Swift

    open var description: String
  • The privileges this user has.

    Declaration

    Swift

    open var privileges = Privileges()
  • The room this user is from.

    Declaration

    Swift

    open let room: ChatRoom
  • Initializes a chat user

    Declaration

    Swift

    public init(room: ChatRoom, id: Int, name: String? = nil)
  • Whether the user has the specified privileges.

    Note

    Room owners, moderators, and the Console user implicitly have all privileges.

    Declaration

    Swift

    public func has(privileges required: Privileges) -> Bool
  • Returns the specified privilege that this user is missing.

    Note

    Room owners, moderators, and the Console user implicitly have all privileges.

    Declaration

    Swift

    public func missing(from required: Privileges) -> Privileges