Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/benjammin4dayz/discord-presence-utils

Tools for managing Discord Rich Presence
https://github.com/benjammin4dayz/discord-presence-utils

class discord ipc remote-procedure-call rich-presence rpc

Last synced: about 2 months ago
JSON representation

Tools for managing Discord Rich Presence

Awesome Lists containing this project

README

        

# Discord Presence Utils

Discord Presence Utils is a collection of easy-to-use modules designed to facilitate the management of Discord Rich Presence from your Node application.

| Docs | Module | Description |
| ----------------------------------- | ------------- | --------------------------------------------------------------- |
| [\[ X \]](./doc/discord-rpc.md) | RPCClient | Simple Discord RPC for setting Rich Presence on Discord. |
| [\[ X \]](./doc/process-monitor.md) | ProcMon | Basic process monitor to detect when a game starts or stops. |
| [\[ X \]](./doc/card-generator.md) | cardGenerator | Create HTML to preview a given presence or display in your docs |

## Usage

1. Install the package with your favorite package manager.

npm install git+https://github.com/benjammin4dayz/discord-presence-utils

> 💡 You may opt to install a specific release tag by adding `#v0.0.0` to the end of this link.

2. Use the provided modules.

```js
import { RPCClient, ProcMon } from "discord-rpc-utils";

const rpc = new RPCClient();
const clientId = "1234567890";
const chrome = new ProcMon(["chrome"]);

chrome.on("start", () => {
rpc.connect(clientId);
rpc.setActivity({
details: "Hello, world!",
state: "I have arrived!",
});
});

chrome.on("stop", () => {
rpc.destroy();
});
```

## Acknowledgements

This repository contains a substantial amount of code from [discordjs/RPC](https://github.com/discordjs/RPC) which is used under the MIT license.