chore: Update docs

This commit is contained in:
Elysia
2024-01-14 17:53:18 +07:00
parent f530b46725
commit 9f19dc09b7
15 changed files with 270 additions and 283 deletions

View File

@@ -180,9 +180,17 @@ class RichPresence {
this.buttons = data.buttons;
this.metadata = data.metadata;
}
/**
* @typedef {string} RichPresenceImage
* Support:
* - cdn.discordapp.com
* - media.discordapp.net
* - Asset ID (From https://discord.com/api/v9/oauth2/applications/:id/assets)
* - ExternalAssets (mp:external/)
*/
/**
* Set the large image of this activity
* @param {?any} image The large image asset's id
* @param {?RichPresenceImage} image The large image asset's id
* @returns {RichPresence}
*/
setAssetsLargeImage(image) {
@@ -198,14 +206,7 @@ class RichPresence {
.replace('http://media.discordapp.net/', 'mp:');
//
if (!image.startsWith('mp:') && !this.ipc) {
throw new Error(
'INVALID_URL',
`
If you want to set the URL directly, it should be the Discord URL (cdn.discordapp.com | media.discordapp.net)
Or follow these instructions:
https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Documents/RichPresence.md#method-3-custom-url-2378
`,
);
throw new Error('INVALID_URL');
}
} else if (/^[0-9]{17,19}$/.test(image)) {
// ID Assets
@@ -219,7 +220,7 @@ https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Documents/RichP
}
/**
* Set the small image of this activity
* @param {?any} image The small image asset's id
* @param {?RichPresenceImage} image The small image asset's id
* @returns {RichPresence}
*/
setAssetsSmallImage(image) {
@@ -235,14 +236,7 @@ https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Documents/RichP
.replace('http://media.discordapp.net/', 'mp:');
//
if (!image.startsWith('mp:') && !this.ipc) {
throw new Error(
'INVALID_URL',
`
If you want to set the URL directly, it should be the Discord URL (cdn.discordapp.com | media.discordapp.net)
Or follow these instructions:
https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Documents/RichPresence.md#method-3-custom-url-2378
`,
);
throw new Error('INVALID_URL');
}
} else if (/^[0-9]{17,19}$/.test(image)) {
// ID Assets

View File

@@ -8,7 +8,11 @@ const Util = require('../util/Util');
/**
* Send Embedlink to Discord
* Need to change WebEmbed API server (because heroku is no longer free)
* <info>Only works with Discord Web and Discord Client (no custom theme installed)</info>
* - No Timestamp, Footer, Fields, Author iconURL
* - Video with Embed working
* - Can only choose between image and thumbnail
* - Description limit 350 characters
*/
class WebEmbed {
/**