Class Client
🏭 Constructors
constructor
new Client(options: ClientOptions): Client
Parameters
- options:
ClientOptions
Return Type
Client
Defined in: packages/discord-rpc/Client.ts:130
🏷️ Properties
_nonceMap
_nonceMap: Map<string, Object> = ...
Defined in: packages/discord-rpc/Client.ts:121
accessToken
accessToken: string
Defined in: packages/discord-rpc/Client.ts:86
application
application: APIApplication
current application
Defined in: packages/discord-rpc/Client.ts:102
clientId
clientId: string
application id
Defined in: packages/discord-rpc/Client.ts:75
clientSecret
clientSecret: string
application secret
Defined in: packages/discord-rpc/Client.ts:79
connectionPromise
connectionPromise: Promise<void>
Defined in: packages/discord-rpc/Client.ts:120
dispatcher
dispatcher: Dispatcher
Defined in: packages/discord-rpc/Client.ts:113
pipeId
pipeId: number
pipe id
Defined in: packages/discord-rpc/Client.ts:84
refreshTimeout
refreshTimeout: Timeout
Defined in: packages/discord-rpc/Client.ts:119
refreshToken
refreshToken: string
Defined in: packages/discord-rpc/Client.ts:87
tokenType
tokenType: string = 'Bearer'
Defined in: packages/discord-rpc/Client.ts:88
transport
transport: Transport
transport instance
Defined in: packages/discord-rpc/Client.ts:93
user
user: ClientUser
current user
Defined in: packages/discord-rpc/Client.ts:98
🔑 Accessors
isConnected
Defined in: packages/discord-rpc/Client.ts:115
🔧 Methods
authenticate
authenticate(): Promise<void>
Return Type
Promise<void>
Defined in: packages/discord-rpc/Client.ts:210
authorize
authorize(options: AuthorizeOptions): Promise<void>
Parameters
- options:
AuthorizeOptions
Return Type
Promise<void>
Defined in: packages/discord-rpc/Client.ts:253
connect
connect(): Promise<void>
connect to the local rpc server
Return Type
Promise<void>
Defined in: packages/discord-rpc/Client.ts:321
destroy
destroy(): Promise<void>
disconnects from the local rpc server
Return Type
Promise<void>
Defined in: packages/discord-rpc/Client.ts:382
hanleAccessTokenResponse
hanleAccessTokenResponse(data: any): void
Parameters
- data:
any
Return Type
void
Defined in: packages/discord-rpc/Client.ts:238
login
login(options: AuthorizeOptions): Promise<void>
will try to authorize if a scope is specified, else it's the same as connect()
Parameters
- options:
AuthorizeOptions
options for the authorization
Return Type
Promise<void>
Defined in: packages/discord-rpc/Client.ts:367
refreshAccessToken
refreshAccessToken(): Promise<void>
Return Type
Promise<void>
Defined in: packages/discord-rpc/Client.ts:218
subscribe
subscribe(event: "OVERLAY" | "CURRENT_USER_UPDATE" | "GUILD_STATUS" | "GUILD_CREATE" | "CHANNEL_CREATE" | "RELATIONSHIP_UPDATE" | "VOICE_CHANNEL_SELECT" | "VOICE_STATE_CREATE" | "VOICE_STATE_DELETE" | "VOICE_STATE_UPDATE" | "VOICE_SETTINGS_UPDATE" | "VOICE_SETTINGS_UPDATE_2" | "VOICE_CONNECTION_STATUS" | "SPEAKING_START" | "SPEAKING_STOP" | "GAME_JOIN" | "GAME_SPECTATE" | "ACTIVITY_JOIN" | "ACTIVITY_JOIN_REQUEST" | "ACTIVITY_SPECTATE" | "ACTIVITY_INVITE" | "ACTIVITY_PIP_MODE_UPDATE" | "NOTIFICATION_CREATE" | "MESSAGE_CREATE" | "MESSAGE_UPDATE" | "MESSAGE_DELETE" | "LOBBY_DELETE" | "LOBBY_UPDATE" | "LOBBY_MEMBER_CONNECT" | "LOBBY_MEMBER_DISCONNECT" | "LOBBY_MEMBER_UPDATE" | "LOBBY_MESSAGE" | "OVERLAY_UPDATE" | "ENTITLEMENT_CREATE" | "ENTITLEMENT_DELETE" | "USER_ACHIEVEMENT_UPDATE" | "VOICE_CHANNEL_EFFECT_SEND" | "THERMAL_STATE_UPDATE", args: any): Promise<Object>
Used to subscribe to events. evt
of the payload should be set to the event being subscribed to. args
of the payload should be set to the args needed for the event.
Parameters
- event:
"OVERLAY" | "CURRENT_USER_UPDATE" | "GUILD_STATUS" | "GUILD_CREATE" | "CHANNEL_CREATE" | "RELATIONSHIP_UPDATE" | "VOICE_CHANNEL_SELECT" | "VOICE_STATE_CREATE" | "VOICE_STATE_DELETE" | "VOICE_STATE_UPDATE" | "VOICE_SETTINGS_UPDATE" | "VOICE_SETTINGS_UPDATE_2" | "VOICE_CONNECTION_STATUS" | "SPEAKING_START" | "SPEAKING_STOP" | "GAME_JOIN" | "GAME_SPECTATE" | "ACTIVITY_JOIN" | "ACTIVITY_JOIN_REQUEST" | "ACTIVITY_SPECTATE" | "ACTIVITY_INVITE" | "ACTIVITY_PIP_MODE_UPDATE" | "NOTIFICATION_CREATE" | "MESSAGE_CREATE" | "MESSAGE_UPDATE" | "MESSAGE_DELETE" | "LOBBY_DELETE" | "LOBBY_UPDATE" | "LOBBY_MEMBER_CONNECT" | "LOBBY_MEMBER_DISCONNECT" | "LOBBY_MEMBER_UPDATE" | "LOBBY_MESSAGE" | "OVERLAY_UPDATE" | "ENTITLEMENT_CREATE" | "ENTITLEMENT_DELETE" | "USER_ACHIEVEMENT_UPDATE" | "VOICE_CHANNEL_EFFECT_SEND" | "THERMAL_STATE_UPDATE"
event name now subscribed to - args:
any
args for the event
Return Type
Promise<Object>
Defined in: packages/discord-rpc/Client.ts:306