From e9ba80a3252592aa194aa889dcdb6cbda0994bdb Mon Sep 17 00:00:00 2001
From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com>
Date: Sun, 17 Apr 2022 00:11:46 +0700
Subject: [PATCH] RPC with Custom Image
and fix something
---
Document/User.md | 30 +++++++++++++++++++++++-
package-lock.json | 14 +++++------
package.json | 4 ++--
src/managers/ClientUserSettingManager.js | 3 ---
4 files changed, 38 insertions(+), 13 deletions(-)
diff --git a/Document/User.md b/Document/User.md
index 15cd913..11f71a0 100644
--- a/Document/User.md
+++ b/Document/User.md
@@ -177,11 +177,39 @@ client.user.setActivity(r.toDiscord().game);
Rich Presence with Twitch / Spotify
-
```js
Update soon ~
```
+New: You can now add custom images for RPC !
+> Tutorial:
++ Step 1: Send photos by embed.thumbnail
+```js
+const embed = new MessageEmbed().setThumbnail('image url');
+const msg = await channel.send({ embeds: [embed] });
+```
++ Step 2: Get proxyURL from message.embeds[0].thumbnail.proxyURL
+```js
+const proxyURL = msg.embeds[0].thumbnail.proxyURL;
+```
++ Step 3: Put the URL in the constructor
+```js
+const RPC = require('discord-rpc-contructor');
+const r = new RPC.Rpc()
+ .setApplicationId('817229550684471297')
+ .setType(0)
+ .setState('State')
+ .setName('Name')
+ .setDetails('Details')
+ .setAssetsLargeImage(proxyURL) // Custom image
+ .setAssetsLargeText('Youtube')
+ .setAssetsSmallImage('895316294222635008')
+ .setAssetsSmallText('Bot')
+client.user.setActivity(r.toDiscord().game);
+```
+
+
+
How to get AssetID ?
Code
diff --git a/package-lock.json b/package-lock.json
index 4d4b9f1..7750446 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -21,7 +21,7 @@
"chalk": "^4.1.2",
"discord-api-types": "^0.31.1",
"discord-bettermarkdown": "^1.1.0",
- "discord-rpc-contructor": "^1.0.5",
+ "discord-rpc-contructor": "^1.1.0",
"discord.js": "^13.6.0",
"form-data": "^4.0.0",
"json-bigint": "^1.0.0",
@@ -4470,9 +4470,9 @@
"integrity": "sha512-UbNg+sO//W3gmEUrzAZ5klDIaVP8Vwnnt0cpqK+5b38/XqGy4mFXv6sdtYZrK+uFow3R4yWzTHMFP9wFF2QHXw=="
},
"node_modules/discord-rpc-contructor": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/discord-rpc-contructor/-/discord-rpc-contructor-1.0.5.tgz",
- "integrity": "sha512-zVMEe5GAGcH4NVTQFV/+p7CjiKtt2E4FNb9P5SCuFwjslZb+5WRTlMPGoXU0/BhEugVdNXvZ+hhvTP427tYWIg==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/discord-rpc-contructor/-/discord-rpc-contructor-1.1.0.tgz",
+ "integrity": "sha512-QPRD2nUSDh2P5YqNvydVftC1OEVb5PC7G+98b96FzCE9UZ5tTf1zc1YK08KM9sAC5APKlukyLHYhCJ3kzVU6RA==",
"dependencies": {
"node-fetch": "^2.6.7"
}
@@ -16431,9 +16431,9 @@
"integrity": "sha512-UbNg+sO//W3gmEUrzAZ5klDIaVP8Vwnnt0cpqK+5b38/XqGy4mFXv6sdtYZrK+uFow3R4yWzTHMFP9wFF2QHXw=="
},
"discord-rpc-contructor": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/discord-rpc-contructor/-/discord-rpc-contructor-1.0.5.tgz",
- "integrity": "sha512-zVMEe5GAGcH4NVTQFV/+p7CjiKtt2E4FNb9P5SCuFwjslZb+5WRTlMPGoXU0/BhEugVdNXvZ+hhvTP427tYWIg==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/discord-rpc-contructor/-/discord-rpc-contructor-1.1.0.tgz",
+ "integrity": "sha512-QPRD2nUSDh2P5YqNvydVftC1OEVb5PC7G+98b96FzCE9UZ5tTf1zc1YK08KM9sAC5APKlukyLHYhCJ3kzVU6RA==",
"requires": {
"node-fetch": "^2.6.7"
}
diff --git a/package.json b/package.json
index 880746b..f8dbaf6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "discord.js-selfbot-v13",
- "version": "1.3.7",
+ "version": "1.3.8",
"description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
"main": "./src/index.js",
"types": "./typings/index.d.ts",
@@ -57,7 +57,7 @@
"chalk": "^4.1.2",
"discord-api-types": "^0.31.1",
"discord-bettermarkdown": "^1.1.0",
- "discord-rpc-contructor": "^1.0.5",
+ "discord-rpc-contructor": "^1.1.0",
"discord.js": "^13.6.0",
"form-data": "^4.0.0",
"json-bigint": "^1.0.0",
diff --git a/src/managers/ClientUserSettingManager.js b/src/managers/ClientUserSettingManager.js
index 0df8fed..909678d 100644
--- a/src/managers/ClientUserSettingManager.js
+++ b/src/managers/ClientUserSettingManager.js
@@ -181,7 +181,6 @@ class ClientUserSettingManager {
* @returns {boolean}
*/
async setDisplayCompactMode(value) {
- if (this.client.bot) throw new Error('INVALID_BOT_METHOD');
if (typeof value !== 'boolean' && value !== null && typeof value !== 'undefined') {
throw new TypeError('INVALID_TYPE', 'value', 'boolean | null | undefined', true);
}
@@ -197,7 +196,6 @@ class ClientUserSettingManager {
* @returns {theme}
*/
async setTheme(value) {
- if (this.client.bot) throw new Error('INVALID_BOT_METHOD');
const validValues = ['dark', 'light'];
if (typeof value !== 'string' && value !== null && typeof value !== 'undefined') {
throw new TypeError('INVALID_TYPE', 'value', 'string | null | undefined', true);
@@ -296,7 +294,6 @@ class ClientUserSettingManager {
* @returns {locale}
*/
async setLocale(value) {
- if (this.client.bot) throw new Error('INVALID_BOT_METHOD');
if (typeof value !== 'string') {
throw new TypeError('INVALID_TYPE', 'value', 'string', true);
}