Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • EventEmitter
    • CosmosClient

Index

Constructors

Properties

bot: Client

The revolt.js Client object

connected: boolean

If the bot is connected to the websocket

loginDetail?: ConnectDetails

Details for logging in

options: Partial<CosmosOptions>

The client options given when initiating the client

Permission checking

uptime: number

Number (in milliseconds) since the bot is ready

Utility functions

prefixed: string | boolean

Accessors

  • get ownerID(): undefined | string

Methods

  • addListener<T>(event: T, fn: (...args: any[]) => void, context?: any): CosmosClient
  • Type parameters

    • T: string | symbol

    Parameters

    • event: T
    • fn: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns CosmosClient

  • emit<T>(event: T, ...args: any[]): boolean
  • Calls each of the listeners registered for a given event.

    Type parameters

    • T: string | symbol

    Parameters

    • event: T
    • Rest ...args: any[]

    Returns boolean

  • eventNames(): (string | symbol)[]
  • Return an array listing the events for which the emitter has registered listeners.

    Returns (string | symbol)[]

  • listenerCount(event: string | symbol): number
  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

    Returns number

  • listeners<T>(event: T): ((...args: any[]) => void)[]
  • Return the listeners registered for a given event.

    Type parameters

    • T: string | symbol

    Parameters

    • event: T

    Returns ((...args: any[]) => void)[]

  • login(detail?: ConnectDetails): Promise<void | ((username: string, loginAfterSuccess?: boolean) => Promise<void>)>
  • Login to Revolt

    Parameters

    • Optional detail: ConnectDetails

      Login details, can also be defined when initiating the client

    Returns Promise<void | ((username: string, loginAfterSuccess?: boolean) => Promise<void>)>

    An onboarding function if required, else undefined or void

  • logout(): Promise<void>
  • off<T>(event: T, fn?: (...args: any[]) => void, context?: any, once?: boolean): CosmosClient
  • Type parameters

    • T: string | symbol

    Parameters

    • event: T
    • Optional fn: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns CosmosClient

  • on(event: "connected", listener: () => void): CosmosClient
  • on(event: "connecting", listener: () => void): CosmosClient
  • on(event: "disconnected", listener: () => void): CosmosClient
  • on(event: "ready", listener: (users: User[], servers: Server[], channels: Channel[], members: Member[]) => void): CosmosClient
  • on(event: "logout", listener: () => void): CosmosClient
  • on(event: "raw", listener: (payload: ClientboundNotification) => void): CosmosClient
  • on(event: "message", listener: (message: Message) => void): CosmosClient
  • on(event: "messageUpdate", listener: (message: Message, details: MessageUpdatedDetails) => void): CosmosClient
  • on(event: "messageDelete", listener: (_id: string) => void): CosmosClient
  • on(event: "channelCreate", listener: (channel: Channel) => void): CosmosClient
  • on(event: "channelUpdate", listener: (channel: Channel, details: ChannelUpdatedDetails) => void): CosmosClient
  • on(event: "channelDelete", listener: (_id: string) => void): CosmosClient
  • on(event: "groupJoin", listener: (_id: string, user: string) => void): CosmosClient
  • on(event: "groupLeave", listener: (_id: string, user: string) => void): CosmosClient
  • on(event: "typingStart", listener: (_id: string, user: string) => void): CosmosClient
  • on(event: "typingStop", listener: (_id: string, user: string) => void): CosmosClient
  • on(event: "channelAck", listener: (_id: string, user: string, message: string) => void): CosmosClient
  • on(event: "serverUpdate", listener: (server: Server, details: ServerUpdatedDetails) => void): CosmosClient
  • on(event: "serverDelete", listener: (_id: string) => void): CosmosClient
  • on(event: "memberJoin", listener: (member: Member) => void): CosmosClient
  • on(event: "memberUpdate", listener: (member: Member, details: MemberUpdatedDetails) => void): CosmosClient
  • on(event: "memberLeave", listener: (_id: MemberCompositeKey) => void): CosmosClient
  • on(event: "roleUpdate", listener: (role: Role, details: RoleUpdatedDetails) => void): CosmosClient
  • on(event: "roleDelete", listener: (_id: string, server: string) => void): CosmosClient
  • on(event: "userUpdate", listener: (user: User, details: UserUpdatedDetails) => void): CosmosClient
  • on(event: "relationshipUpdate", listener: (_id: string, user: string, relationship: RelationshipStatus) => void): CosmosClient
  • on(event: string, listener: (...args: any[]) => void): CosmosClient
  • Emitted when the server authenticated the connection

    Parameters

    • event: "connected"
    • listener: () => void
        • (): void
        • Returns void

    Returns CosmosClient

  • Emitted when the client is connecting to the server

    Parameters

    • event: "connecting"
    • listener: () => void
        • (): void
        • Returns void

    Returns CosmosClient

  • Emitted when the connection dropped

    Parameters

    • event: "disconnected"
    • listener: () => void
        • (): void
        • Returns void

    Returns CosmosClient

  • Emitted when the client is ready

    Parameters

    • event: "ready"
    • listener: (users: User[], servers: Server[], channels: Channel[], members: Member[]) => void
        • (users: User[], servers: Server[], channels: Channel[], members: Member[]): void
        • Parameters

          • users: User[]
          • servers: Server[]
          • channels: Channel[]
          • members: Member[]

          Returns void

    Returns CosmosClient

  • Emitted when the client logged out

    Parameters

    • event: "logout"
    • listener: () => void
        • (): void
        • Returns void

    Returns CosmosClient

  • Emitted when the websocket receives any data

    Parameters

    • event: "raw"
    • listener: (payload: ClientboundNotification) => void
        • (payload: ClientboundNotification): void
        • Parameters

          • payload: ClientboundNotification

          Returns void

    Returns CosmosClient

  • Emitted when a message is sent

    Parameters

    • event: "message"
    • listener: (message: Message) => void
        • (message: Message): void
        • Parameters

          • message: Message

          Returns void

    Returns CosmosClient

  • Emitted when a message is edited

    Parameters

    Returns CosmosClient

  • Emitted when a message is deleted

    Parameters

    • event: "messageDelete"
    • listener: (_id: string) => void
        • (_id: string): void
        • Parameters

          • _id: string

          Returns void

    Returns CosmosClient

  • Emitted when a new channel is created

    Parameters

    • event: "channelCreate"
    • listener: (channel: Channel) => void
        • (channel: Channel): void
        • Parameters

          • channel: Channel

          Returns void

    Returns CosmosClient

  • Emitted when a channel is editedhas updated changes

    Parameters

    Returns CosmosClient

  • Emitted when a channel is deleted

    Parameters

    • event: "channelDelete"
    • listener: (_id: string) => void
        • (_id: string): void
        • Parameters

          • _id: string

          Returns void

    Returns CosmosClient

  • Emitted when a user joined a group

    Parameters

    • event: "groupJoin"
    • listener: (_id: string, user: string) => void
        • (_id: string, user: string): void
        • Parameters

          • _id: string
          • user: string

          Returns void

    Returns CosmosClient

  • Emitted when a group member left a group

    Parameters

    • event: "groupLeave"
    • listener: (_id: string, user: string) => void
        • (_id: string, user: string): void
        • Parameters

          • _id: string
          • user: string

          Returns void

    Returns CosmosClient

  • Emitted when a user started typing in a channel

    Parameters

    • event: "typingStart"
    • listener: (_id: string, user: string) => void
        • (_id: string, user: string): void
        • Parameters

          • _id: string
          • user: string

          Returns void

    Returns CosmosClient

  • Emitted when a user stopped typing in a channel

    Parameters

    • event: "typingStop"
    • listener: (_id: string, user: string) => void
        • (_id: string, user: string): void
        • Parameters

          • _id: string
          • user: string

          Returns void

    Returns CosmosClient

  • Emitted when the client acknowledged new messages in a channel up to @param message message ID

    Parameters

    • event: "channelAck"
    • listener: (_id: string, user: string, message: string) => void
        • (_id: string, user: string, message: string): void
        • Parameters

          • _id: string
          • user: string
          • message: string

          Returns void

    Returns CosmosClient

  • Emitted when a server has updated details

    Parameters

    Returns CosmosClient

  • Emitted when a server has been deleted

    Parameters

    • event: "serverDelete"
    • listener: (_id: string) => void
        • (_id: string): void
        • Parameters

          • _id: string

          Returns void

    Returns CosmosClient

  • Emitted when a member joined a server

    Parameters

    • event: "memberJoin"
    • listener: (member: Member) => void
        • (member: Member): void
        • Parameters

          • member: Member

          Returns void

    Returns CosmosClient

  • Emitted when a member has updated changes

    Parameters

    Returns CosmosClient

  • Emitted when a member left a server

    Parameters

    • event: "memberLeave"
    • listener: (_id: MemberCompositeKey) => void
        • (_id: MemberCompositeKey): void
        • Parameters

          • _id: MemberCompositeKey

          Returns void

    Returns CosmosClient

  • Emitted when a role is created or updated

    Parameters

    Returns CosmosClient

  • Emitted when a role is deleted

    Parameters

    • event: "roleDelete"
    • listener: (_id: string, server: string) => void
        • (_id: string, server: string): void
        • Parameters

          • _id: string
          • server: string

          Returns void

    Returns CosmosClient

  • Emitted when a user has updated changes

    Parameters

    Returns CosmosClient

  • Emitted when the client updated their relationship with a user

    Parameters

    • event: "relationshipUpdate"
    • listener: (_id: string, user: string, relationship: RelationshipStatus) => void
        • (_id: string, user: string, relationship: RelationshipStatus): void
        • Parameters

          • _id: string
          • user: string
          • relationship: RelationshipStatus

          Returns void

    Returns CosmosClient

  • Custom events (if you want to add some)

    Parameters

    • event: string
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns CosmosClient

  • once<T>(event: T, fn: (...args: any[]) => void, context?: any): CosmosClient
  • Add a one-time listener for a given event.

    Type parameters

    • T: string | symbol

    Parameters

    • event: T
    • fn: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns CosmosClient

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: string | symbol

    Returns CosmosClient

  • removeListener<T>(event: T, fn?: (...args: any[]) => void, context?: any, once?: boolean): CosmosClient
  • Remove the listeners of a given event.

    Type parameters

    • T: string | symbol

    Parameters

    • event: T
    • Optional fn: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns CosmosClient

Generated using TypeDoc