Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/discord_rpc/mod.ts>DiscordIPC

Discord RPC module for Deno.
Go to Latest
class DiscordIPC
Re-export
import { DiscordIPC } from "https://deno.land/x/discord_rpc@0.3.0/mod.ts";

Constructors

new
DiscordIPC(conn: Deno.Conn)

Methods

Closes the connection to Discord IPC Socket and any open ReadableStreams for events.

login(clientID: string)

Performs initial handshake.

send<T extends Record<string, unknown>>(op: OpCode, payload: T)

Send a packet to Discord IPC. Returns nonce.

Nonce is generated if the payload does not have a nonce property and is added to payload object too.

If payload object does contain a nonce, then it is returned instead.

sendCommand<T = unknown, T2 extends Record<string, unknown> = Record<string, unknown>>(
cmd: Command | keyof Command,
args: T2,
evt?: keyof RPCEvent,
): Promise<T>

Sends a Managed Command to Discord IPC.

Managed means it resolves when Discord sends back some response, or rejects when an ERROR event is DISPATCHed instead.

[Symbol.asyncIterator](): AsyncIterableIterator<IPCEvent>