# Class: Client

param The client's token used for gateway connection.

param The socket.

param The configurations.

# Hierarchy

  • EventEmitter

    Client

# Index

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new Client(token: string, options?: ClientOptions): Client

Overrides void

Defined in src/websocket.ts:88 (opens new window)

The main client constructor.

# Parameters:

Name Type Description
token string The client's token used for gateway connection.
options? ClientOptions -

Returns: Client

# Properties

# activities

activities: any

Defined in src/websocket.ts:84 (opens new window)


# cache

cache: any

Defined in src/websocket.ts:86 (opens new window)


# config

config: ClientOptions

Defined in src/websocket.ts:85 (opens new window)


# hb

Readonly hb: Timeout

Defined in src/websocket.ts:81 (opens new window)


# security

security: SecurityProperties

Defined in src/websocket.ts:88 (opens new window)


# socket

socket: any

Defined in src/websocket.ts:83 (opens new window)


# token

Readonly token: string

Defined in src/websocket.ts:80 (opens new window)


# user

Readonly user: User

Defined in src/websocket.ts:82 (opens new window)


# ws

ws: WSProperties

Defined in src/websocket.ts:87 (opens new window)


# defaultMaxListeners

Static defaultMaxListeners: number

Inherited from Client.defaultMaxListeners

Defined in node_modules/@types/node/events.d.ts:45


# errorMonitor

Static Readonly errorMonitor: unique symbol

Inherited from Client.errorMonitor

Defined in node_modules/@types/node/events.d.ts:55

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

# Methods

# _GetRestUser

_GetRestUser(userID: string): Promise<User>

Defined in src/websocket.ts:229 (opens new window)

The method used to fetch a user from the rest discord API.

# Parameters:

Name Type Description
userID string The ID of the user to fetch.

Returns: Promise<User>


# _MessageEmbed

_MessageEmbed(channel: string, options: EmbedProperties): Promise<any>

Defined in src/websocket.ts:219 (opens new window)

The method used to send an embed in a TextChannel.

# Parameters:

Name Type Description
channel string ID of the TextChannel the embed will be sent in.
options EmbedProperties The embed data.

Returns: Promise<any>


# _sendMessage

_sendMessage(channel: string, content: string | object): Promise<MessageRaw>

Defined in src/websocket.ts:199 (opens new window)

The method used to send a message to a TextChannel.

# Parameters:

Name Type Description
channel string ID of the TextChannel the message will be sent in.
content string | object The body of the message.

Returns: Promise<MessageRaw>


# addListener

addListener(event: string | symbol, listener: (...args: any[]) => void): this

Inherited from Client.addListener

Defined in node_modules/@types/node/events.d.ts:62

# Parameters:

Name Type
event string | symbol
listener (...args: any[]) => void

Returns: this


# connect

connect(): void

Defined in src/websocket.ts:151 (opens new window)

The method used to connect to the gateway.

Returns: void


# createChannel

createChannel(g: string, name: string): Promise<any>

Defined in src/websocket.ts:301 (opens new window)

The method used to create a GuildChannel.

# Parameters:

Name Type Description
g string ID of the guild where the channel will be created in.
name string The name of the channel.

Returns: Promise<any>


# destroy

destroy(reason?: string): void

Defined in src/websocket.ts:175 (opens new window)

The method used to destroy the client and close the connection to the websocket.

# Parameters:

Name Type
reason? string

Returns: void


# emit

emit(event: string | symbol, ...args: any[]): boolean

Inherited from Client.emit

Defined in node_modules/@types/node/events.d.ts:72

# Parameters:

Name Type
event string | symbol
...args any[]

Returns: boolean


# evaluate

evaluate(data: any, flag: any): string

Defined in src/websocket.ts:263 (opens new window)

Evaluates under the hood stuff.

# Parameters:

Name Type Description
data any The data to evaluate.
flag any The flags for evaluation.

Returns: string


# eventNames

eventNames(): Array<string | symbol>

Inherited from Client.eventNames

Defined in node_modules/@types/node/events.d.ts:77

Returns: Array<string | symbol>


# getGlobalSlashcommands

getGlobalSlashcommands(): Promise<SlashConfig>

Defined in src/websocket.ts:183 (opens new window)

Returns: Promise<SlashConfig>


# getMaxListeners

getMaxListeners(): number

Inherited from Client.getMaxListeners

Defined in node_modules/@types/node/events.d.ts:69

Returns: number


# getMetaData

getMetaData(): any

Defined in src/websocket.ts:238 (opens new window)

The method used to get the metadata.

Returns: any


# listenerCount

listenerCount(event: string | symbol): number

Inherited from Client.listenerCount

Defined in node_modules/@types/node/events.d.ts:73

# Parameters:

Name Type
event string | symbol

Returns: number


# listeners

listeners(event: string | symbol): Function[]

Inherited from Client.listeners

Defined in node_modules/@types/node/events.d.ts:70

# Parameters:

Name Type
event string | symbol

Returns: Function[]


# off

off(event: string | symbol, listener: (...args: any[]) => void): this

Inherited from Client.off

Defined in node_modules/@types/node/events.d.ts:66

# Parameters:

Name Type
event string | symbol
listener (...args: any[]) => void

Returns: this


# on

on(event: "ready", listener: (user: User) => void): this

Overrides void

Defined in src/websocket.ts:68 (opens new window)

# Parameters:

Name Type
event "ready"
listener (user: User) => void

Returns: this

on(event: "debug", listener: (message: string) => void): this

Overrides void

Defined in src/websocket.ts:69 (opens new window)

# Parameters:

Name Type
event "debug"
listener (message: string) => void

Returns: this

on(event: "message", listener: (message: Message) => void): this

Overrides void

Defined in src/websocket.ts:70 (opens new window)

# Parameters:

Name Type
event "message"
listener (message: Message) => void

Returns: this

on(event: "error", listener: (error: any) => void): this

Overrides void

Defined in src/websocket.ts:71 (opens new window)

# Parameters:

Name Type
event "error"
listener (error: any) => void

Returns: this


# once

once(event: string | symbol, listener: (...args: any[]) => void): this

Inherited from Client.once

Defined in node_modules/@types/node/events.d.ts:64

# Parameters:

Name Type
event string | symbol
listener (...args: any[]) => void

Returns: this


# prependListener

prependListener(event: string | symbol, listener: (...args: any[]) => void): this

Inherited from Client.prependListener

Defined in node_modules/@types/node/events.d.ts:75

# Parameters:

Name Type
event string | symbol
listener (...args: any[]) => void

Returns: this


# prependOnceListener

prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this

Inherited from Client.prependOnceListener

Defined in node_modules/@types/node/events.d.ts:76

# Parameters:

Name Type
event string | symbol
listener (...args: any[]) => void

Returns: this


# rawListeners

rawListeners(event: string | symbol): Function[]

Inherited from Client.rawListeners

Defined in node_modules/@types/node/events.d.ts:71

# Parameters:

Name Type
event string | symbol

Returns: Function[]


# removeAllListeners

removeAllListeners(event?: string | symbol): this

Inherited from Client.removeAllListeners

Defined in node_modules/@types/node/events.d.ts:67

# Parameters:

Name Type
event? string | symbol

Returns: this


# removeListener

removeListener(event: string | symbol, listener: (...args: any[]) => void): this

Inherited from Client.removeListener

Defined in node_modules/@types/node/events.d.ts:65

# Parameters:

Name Type
event string | symbol
listener (...args: any[]) => void

Returns: this


# request

request(method: string, path: string, body?: object): Promise<Response | any>

Defined in src/websocket.ts:136 (opens new window)

Requests to a specific discord API endpoint.

# Parameters:

Name Type Default value Description
method string - method, e.g: GET, POST, DELETE, PUT, etc.
path string - path of URL.
body object null body/data of Request.

Returns: Promise<Response | any>


# setMaxListeners

setMaxListeners(n: number): this

Inherited from Client.setMaxListeners

Defined in node_modules/@types/node/events.d.ts:68

# Parameters:

Name Type
n number

Returns: this


# setStatus

setStatus(t: "online" | "idle" | "dnd" | "invisible"): void

Defined in src/websocket.ts:277 (opens new window)

The method used to set the status of the client.

# Parameters:

Name Type Description
t "online" | "idle" | "dnd" | "invisible" The status type to set client's status to.

Returns: void


# listenerCount

StaticlistenerCount(emitter: EventEmitter, event: string | symbol): number

Inherited from Client.listenerCount

Defined in node_modules/@types/node/events.d.ts:44

deprecated since v4.0.0

# Parameters:

Name Type
emitter EventEmitter
event string | symbol

Returns: number

Last Updated: 12/19/2020, 4:43:00 PM