Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • EventEmitter
    • Client

Index

Properties

applicationCommand: ApplicationCommandManager

Application Command Manager to interact with the REST API

auditLog: AuditLogManager

Audit Log Manager to interact with the REST API

Channel Manager to interact with the REST API

Emoji Manager to interact with the REST API

Guild Manager to interact with the REST API

guildScheduledEvent: GuildScheduledEventManager

Guild Scheduled Event Manager to interact with the REST API

guildTemplate: GuildTemplateManager

Guild Template Manager to interact with the REST API

intents: number

Intents the application has activated

interaction: InteractionManager

Integration Manager to interact with the REST API

Invite Manager to interact with the REST API

stageInstance: StageInstanceManager

Stage Instance Manager to interact with the REST API

Sticker Manager to interact with the REST API

User Manager to interact with the REST API

version: APIVersions

API Version to use

Voice Manager to interact with the REST API

Webhook Manager to interact with the REST API

#cache: CacheManager = ...

Application's cache

#connection_closed: boolean = false
#hearbeat_responded: boolean = false
#heartbeat_interval: number = 0
#sequence_number: null | number = null
#session_id: string = ''
#token: string

Application's token

#tokenType: "" | "Bearer" | "Bot"

Token type

#ws: WebSocket = ...

Websocket to connect the application to the Discord Gateway

Constructors

  • Parameters

    Returns Client

Methods

  • It takes an event name and any number of arguments, and calls the emit method on the Client class with the event name and arguments

    Type Parameters

    Parameters

    • eventName: K

      The name of the event to emit.

    • Rest ...args: ClientEvents[K]

      The arguments to pass to the event handler.

    Returns boolean

    The return value is a boolean that indicates whether the event was emitted.

  • The on function is a method that adds a listener to the client's event emitter

    Type Parameters

    Parameters

    • eventName: K

      The name of the event you want to listen to.

    • listener: ((...args: ClientEvents[K]) => void)

      The listener function that will be called when the event is emitted.

    Returns Client

    The this object.

  • The once method is a method that allows you to listen to an event only once.

    Type Parameters

    Parameters

    • eventName: K

      The name of the event you want to listen to.

    • listener: ((...args: ClientEvents[K]) => void)

      The listener function that will be called when the event is emitted.

    Returns Client

    The client.

  • setStatus(presence: GatewayPresenceUpdateData): void
  • Interact with the Discord Gateway to add a Presence to the Bot User

    Parameters

    • presence: GatewayPresenceUpdateData

      New presence to set

    Returns void

  • handleEvent<K>(event: K, object: unknown): undefined | boolean
  • When a Gateway event is received, emit it to the client

    Type Parameters

    Parameters

    • event: K

      The event name.

    • object: unknown

      The object that was dispatched.

    Returns undefined | boolean

  • intentsToNumber(intents: ("GUILDS" | "GUILD_MEMBERS" | "GUILD_BANS" | "GUILD_EMOJIS_AND_STICKERS" | "GUILD_INTEGRATIONS" | "GUILD_WEBHOOKS" | "GUILD_INVITES" | "GUILD_VOICE_STATES" | "GUILD_PRESENCES" | "GUILD_MESSAGES" | "GUILD_MESSAGE_REACTIONS" | "GUILD_MESSAGE_TYPING" | "DIRECT_MESSAGES" | "DIRECT_MESSAGE_REACTIONS" | "DIRECT_MESSAGE_TYPING" | "GUILD_SCHEDULED_EVENTS")[]): number
  • Given a list of intents, return the number that represents them

    Parameters

    • intents: ("GUILDS" | "GUILD_MEMBERS" | "GUILD_BANS" | "GUILD_EMOJIS_AND_STICKERS" | "GUILD_INTEGRATIONS" | "GUILD_WEBHOOKS" | "GUILD_INVITES" | "GUILD_VOICE_STATES" | "GUILD_PRESENCES" | "GUILD_MESSAGES" | "GUILD_MESSAGE_REACTIONS" | "GUILD_MESSAGE_TYPING" | "DIRECT_MESSAGES" | "DIRECT_MESSAGE_REACTIONS" | "DIRECT_MESSAGE_TYPING" | "GUILD_SCHEDULED_EVENTS")[]

      An array of intents to be added to the client.

    Returns number

    The number of intents in the array.

  • setupWebSocket(): Promise<void>
  • It sets up the WebSocket connection and listens for messages from Discord

    Returns Promise<void>

Generated using TypeDoc