# discord.js-selfbot-rpc
A simple package to create a Discord Rich Presence for selfbot using [discord.js-selfbot-v13](https://npmjs.com/package/discord.js-selfbot-v13) library

[![npm:discord.js-selfbot-rpc](https://img.shields.io/npm/v/discord.js-selfbot-rpc.svg)](https://npmjs.com/package/discord.js-selfbot-rpc)
## Installation
```sh-session
npm install discord.js-selfbot-rpc
```
### Example (`Rich Presence`)
#### Simple:
```js
const { Client } = require('discord.js-selfbot-v13');
const client = new Client();

const { RichPresence } = require('discord.js-selfbot-rpc');

client.on('ready', () => {
    const presence = new RichPresence()
        .setStatus('dnd') // Must be one of (online, idle, dnd) default is online
        .setName('Discord')
        .setTimestamp();

    client.user.setPresence(presence.toData());
    console.log('Rich Presence has running...');

    console.log(`Login as ${client.user.tag}`);
});

client.login('token');
```
![example-rpc:simple](https://raw.githubusercontent.com/DevinOfficial/discord.js-selfbot-rpc/main/assets/example_rpc_basic.png)
#### With customization + image:
```js
const { Client } = require('discord.js-selfbot-v13');
const client = new Client();

const { RichPresence, Util } = require('discord.js-selfbot-rpc');

client.on('ready', async() => { // Using async-await to perform util get application assets
    const applicationId = '984373297644961894'; // Your Application ID

    // This is example for get image assets data from application
    const chromeImage = await Util.getAssets(applicationId, 'chrome'); // Get image assets by name (chrome) from application assets
    const googleImage = await Util.getAssets(applicationId, 'google'); // Get image assets by name (google) from application assets

    const presence = new RichPresence()
        .setStatus('dnd') // Must be one of (online, idle, dnd) default is online
        .setType('PLAYING') // Must be one of (PLAYING, STREAMING, LISTENING, WATCHING) default is PLAYING
        .setApplicationId(applicationId)
        .setName('Chrome')
        .setDetails('View Homepage')
        .setState('Searching anime...')
        .setAssetsLargeImage(chromeImage.id)
        .setAssetsLargeText('Chrome')
        .setAssetsSmallImage(googleImage.id)
        .setAssetsSmallText('Google')
        .setTimestamp();

    client.user.setPresence(presence.toData());
    console.log('Rich Presence has running...');

    console.log(`Login as ${client.user.tag}`);
});

client.login('token');
```
![example-rpc:chrome](https://raw.githubusercontent.com/DevinOfficial/discord.js-selfbot-rpc/main/assets/example_rpc_chrome.png)
### Example (`Custom Status`)
#### Simple:
```js
const { Client } = require('discord.js-selfbot-v13');
const client = new Client();

const { CustomStatus } = require('discord.js-selfbot-rpc');

client.on('ready', () => {
    const customStatus = new CustomStatus()
        .setStatus('dnd') // Must be one of (online, idle, dnd) default is online
        .setState('Powered by discord.js-selfbot-rpc');

    client.user.setPresence(customStatus.toData());
    console.log('Custom Status has running...');

    console.log(`Login as ${client.user.tag}`);
});

client.login('token');
```
![example-cs:simple](https://raw.githubusercontent.com/DevinOfficial/discord.js-selfbot-rpc/main/assets/example_cs.png)
#### With custom emoji:
**Important!** Using discord custom emoji only applies to nitro users!
```js
const { Client } = require('discord.js-selfbot-v13');
const client = new Client();

const { CustomStatus } = require('discord.js-selfbot-rpc');

client.on('ready', () => {
    const customStatus = new CustomStatus()
        .setStatus('dnd') // Must be one of (online, idle, dnd) default is online
        .setState('Powered by discord.js-selfbot-rpc')
        .setEmoji('🔥');

    client.user.setPresence(customStatus.toData());
    console.log('Custom Status has running...');

    console.log(`Login as ${client.user.tag}`);
});

client.login('token');
```
![example-cs:with_emoji](https://raw.githubusercontent.com/DevinOfficial/discord.js-selfbot-rpc/main/assets/example_cs_e.png)
### Example (`Util`)
Here are some examples of using `Util` from this package that you can use
```js
const { Util } = require('discord.js-selfbot-rpc');
const applicationId = '984373297644961894'; // Your Application ID 

// Fetch available assets data from application
Util.fetchAssets(applicationId).then(result => {
    console.log(result); // JSON { data: Array, statusCode: Number }
})
.catch(console.error);

// Find image assets by name from application
Util.getAssets(applicationId, 'assets text name').then(result => 
    console.log(result); // return raw object, but undefined is result not available
})
.catch(console.error);
```
