RPC with Custom Image

and fix something
This commit is contained in:
March 7th 2022-04-17 00:11:46 +07:00
parent 70637bb8d6
commit e9ba80a325
4 changed files with 38 additions and 13 deletions

View File

@ -177,11 +177,39 @@ client.user.setActivity(r.toDiscord().game);
<img src='https://cdn.discordapp.com/attachments/820557032016969751/955767445220646922/unknown.png'> <img src='https://cdn.discordapp.com/attachments/820557032016969751/955767445220646922/unknown.png'>
Rich Presence with Twitch / Spotify Rich Presence with Twitch / Spotify
```js ```js
Update soon ~ Update soon ~
``` ```
<strong>New: You can now add custom images for RPC !</strong>
> 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);
```
<strong>How to get AssetID ?</strong> <strong>How to get AssetID ?</strong>
Code Code

14
package-lock.json generated
View File

@ -21,7 +21,7 @@
"chalk": "^4.1.2", "chalk": "^4.1.2",
"discord-api-types": "^0.31.1", "discord-api-types": "^0.31.1",
"discord-bettermarkdown": "^1.1.0", "discord-bettermarkdown": "^1.1.0",
"discord-rpc-contructor": "^1.0.5", "discord-rpc-contructor": "^1.1.0",
"discord.js": "^13.6.0", "discord.js": "^13.6.0",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"json-bigint": "^1.0.0", "json-bigint": "^1.0.0",
@ -4470,9 +4470,9 @@
"integrity": "sha512-UbNg+sO//W3gmEUrzAZ5klDIaVP8Vwnnt0cpqK+5b38/XqGy4mFXv6sdtYZrK+uFow3R4yWzTHMFP9wFF2QHXw==" "integrity": "sha512-UbNg+sO//W3gmEUrzAZ5klDIaVP8Vwnnt0cpqK+5b38/XqGy4mFXv6sdtYZrK+uFow3R4yWzTHMFP9wFF2QHXw=="
}, },
"node_modules/discord-rpc-contructor": { "node_modules/discord-rpc-contructor": {
"version": "1.0.5", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/discord-rpc-contructor/-/discord-rpc-contructor-1.0.5.tgz", "resolved": "https://registry.npmjs.org/discord-rpc-contructor/-/discord-rpc-contructor-1.1.0.tgz",
"integrity": "sha512-zVMEe5GAGcH4NVTQFV/+p7CjiKtt2E4FNb9P5SCuFwjslZb+5WRTlMPGoXU0/BhEugVdNXvZ+hhvTP427tYWIg==", "integrity": "sha512-QPRD2nUSDh2P5YqNvydVftC1OEVb5PC7G+98b96FzCE9UZ5tTf1zc1YK08KM9sAC5APKlukyLHYhCJ3kzVU6RA==",
"dependencies": { "dependencies": {
"node-fetch": "^2.6.7" "node-fetch": "^2.6.7"
} }
@ -16431,9 +16431,9 @@
"integrity": "sha512-UbNg+sO//W3gmEUrzAZ5klDIaVP8Vwnnt0cpqK+5b38/XqGy4mFXv6sdtYZrK+uFow3R4yWzTHMFP9wFF2QHXw==" "integrity": "sha512-UbNg+sO//W3gmEUrzAZ5klDIaVP8Vwnnt0cpqK+5b38/XqGy4mFXv6sdtYZrK+uFow3R4yWzTHMFP9wFF2QHXw=="
}, },
"discord-rpc-contructor": { "discord-rpc-contructor": {
"version": "1.0.5", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/discord-rpc-contructor/-/discord-rpc-contructor-1.0.5.tgz", "resolved": "https://registry.npmjs.org/discord-rpc-contructor/-/discord-rpc-contructor-1.1.0.tgz",
"integrity": "sha512-zVMEe5GAGcH4NVTQFV/+p7CjiKtt2E4FNb9P5SCuFwjslZb+5WRTlMPGoXU0/BhEugVdNXvZ+hhvTP427tYWIg==", "integrity": "sha512-QPRD2nUSDh2P5YqNvydVftC1OEVb5PC7G+98b96FzCE9UZ5tTf1zc1YK08KM9sAC5APKlukyLHYhCJ3kzVU6RA==",
"requires": { "requires": {
"node-fetch": "^2.6.7" "node-fetch": "^2.6.7"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "discord.js-selfbot-v13", "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]", "description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
"main": "./src/index.js", "main": "./src/index.js",
"types": "./typings/index.d.ts", "types": "./typings/index.d.ts",
@ -57,7 +57,7 @@
"chalk": "^4.1.2", "chalk": "^4.1.2",
"discord-api-types": "^0.31.1", "discord-api-types": "^0.31.1",
"discord-bettermarkdown": "^1.1.0", "discord-bettermarkdown": "^1.1.0",
"discord-rpc-contructor": "^1.0.5", "discord-rpc-contructor": "^1.1.0",
"discord.js": "^13.6.0", "discord.js": "^13.6.0",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"json-bigint": "^1.0.0", "json-bigint": "^1.0.0",

View File

@ -181,7 +181,6 @@ class ClientUserSettingManager {
* @returns {boolean} * @returns {boolean}
*/ */
async setDisplayCompactMode(value) { async setDisplayCompactMode(value) {
if (this.client.bot) throw new Error('INVALID_BOT_METHOD');
if (typeof value !== 'boolean' && value !== null && typeof value !== 'undefined') { if (typeof value !== 'boolean' && value !== null && typeof value !== 'undefined') {
throw new TypeError('INVALID_TYPE', 'value', 'boolean | null | undefined', true); throw new TypeError('INVALID_TYPE', 'value', 'boolean | null | undefined', true);
} }
@ -197,7 +196,6 @@ class ClientUserSettingManager {
* @returns {theme} * @returns {theme}
*/ */
async setTheme(value) { async setTheme(value) {
if (this.client.bot) throw new Error('INVALID_BOT_METHOD');
const validValues = ['dark', 'light']; const validValues = ['dark', 'light'];
if (typeof value !== 'string' && value !== null && typeof value !== 'undefined') { if (typeof value !== 'string' && value !== null && typeof value !== 'undefined') {
throw new TypeError('INVALID_TYPE', 'value', 'string | null | undefined', true); throw new TypeError('INVALID_TYPE', 'value', 'string | null | undefined', true);
@ -296,7 +294,6 @@ class ClientUserSettingManager {
* @returns {locale} * @returns {locale}
*/ */
async setLocale(value) { async setLocale(value) {
if (this.client.bot) throw new Error('INVALID_BOT_METHOD');
if (typeof value !== 'string') { if (typeof value !== 'string') {
throw new TypeError('INVALID_TYPE', 'value', 'string', true); throw new TypeError('INVALID_TYPE', 'value', 'string', true);
} }