@types/discord-rich-presence
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Installation

npm install --save @types/discord-rich-presence

Summary

This package contains type definitions for discord-rich-presence (https://github.com/devsnek/discord-rich-presence#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/discord-rich-presence.

index.d.ts

/// <reference types="node" />

import { EventEmitter } from "events";

declare namespace createClient {
    /**
     * Go to the `Rich Presence > Visualizer` settings of your [Discord application](https://discord.com/developers/applications) to find out how this would be rendered.
     */
    interface PresenceInfo {
        [key: string]: string | number | Date | boolean;

        /** The user's current party status */
        state: string;
        /** What the player is currently doing */
        details: string;
        /** Epoch seconds for game start - setting this will show the time as "elapsed" */
        startTimestamp: number | Date;
        /** Epoch seconds until game's end - setting this will show the time as "remaining" */
        endTimestamp: number | Date;
        /** Key of the uploaded image / asset for the large profile artwork */
        largeImageKey: string;
        /** Key of the uploaded image / asset for the small profile artwork */
        smallImageKey: string;

        instance: boolean;
    }

    interface RP {
        on(event: "error", listener: (err: string) => void): this;
        on(event: "connected", listener: () => void): this;
        on(event: "join" | "spectate", listener: (secret: string) => void): this;
        on(event: "joinRequest", listener: (user: string) => void): this;
    }

    class RP extends EventEmitter {
        /**
         * Updates the presence
         * @param presence Presence settings object. All properties are optional.
         */
        updatePresence(presence: Partial<PresenceInfo>): void;

        reply(user: string, response: "YES" | "NO" | "IGNORE"): void;
        disconnect(): void;
    }
}

/**
 * Connects to your application
 * @param clientID Get the client ID from the `General Information` page of your [Discord application](https://discord.com/developers/applications)
 */
declare function createClient(clientID: string): createClient.RP;

export = createClient;

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Sv443.

Dependents (0)

Package Sidebar

Install

npm i @types/discord-rich-presence

Weekly Downloads

63

Version

0.0.2

License

MIT

Unpacked Size

6.65 kB

Total Files

5

Last publish

Collaborators

  • types