document
This commit is contained in:
parent
efe416340d
commit
95cc955da9
1
discord.js/main.json
Normal file
1
discord.js/main.json
Normal file
File diff suppressed because one or more lines are too long
@ -14,8 +14,8 @@
|
||||
"format": "prettier --write src/**/*.js typings/**/*.ts",
|
||||
"lint:all": "npm run lint && npm run lint:typings",
|
||||
"checkup": "node update.mjs",
|
||||
"docs": "docgen --source src --custom docs/index.yml --output docs/docs.json",
|
||||
"docs:test": "docgen --source src --custom docs/index.yml"
|
||||
"docs": "docgen --source src --custom discord.js/index.yml --output discord.js/main.json",
|
||||
"docs:test": "docgen --source src --custom discord.js/index.yml"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
|
@ -3,7 +3,7 @@
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const User = require('./User');
|
||||
const { Util } = require('..');
|
||||
const { HypeSquadOptions, Opcodes } = require('../util/Constants');
|
||||
const { HypeSquadOptions, Opcodes, NitroState } = require('../util/Constants');
|
||||
const DataResolver = require('../util/DataResolver');
|
||||
|
||||
/**
|
||||
@ -17,6 +17,10 @@ class ClientUser extends User {
|
||||
/*
|
||||
Add: notes
|
||||
*/
|
||||
/**
|
||||
* The notes cache of the client user.
|
||||
* @type {Collection<Snowflake, Message>}
|
||||
*/
|
||||
this.notes = new Collection();
|
||||
// This.messageMentions = new Collection();
|
||||
|
||||
@ -41,15 +45,11 @@ class ClientUser extends User {
|
||||
if ('token' in data) this.client.token = data.token;
|
||||
|
||||
// Add (Selfbot)
|
||||
if ('premium' in data) this.nitro = data.premium;
|
||||
if ('premium' in data) this.nitro = NitroState[data.premium];
|
||||
/**
|
||||
* Nitro Status
|
||||
* `0`: None
|
||||
* `1`: Classic
|
||||
* `2`: Boost
|
||||
* @external
|
||||
* https://discord.com/developers/docs/resources/user#user-object-premium-types
|
||||
* @type {Number}
|
||||
* @type {NitroState}
|
||||
* @see https://discord.com/developers/docs/resources/user#user-object-premium-types
|
||||
*/
|
||||
if ('purchased_flags' in data) this.nitroType = data.purchased_flags;
|
||||
if ('phone' in data) this.phoneNumber = data.phone;
|
||||
|
@ -6,8 +6,37 @@ const hiddenCharter =
|
||||
const { RangeError } = require('../errors');
|
||||
const Util = require('../util/Util');
|
||||
|
||||
/**
|
||||
* Send Embedlink to Discord
|
||||
*/
|
||||
class WebEmbed {
|
||||
constructor(data = {}) {
|
||||
/**
|
||||
* A `Partial` object is a representation of any existing object.
|
||||
* This object contains between 0 and all of the original objects parameters.
|
||||
* This is true regardless of whether the parameters are optional in the base object.
|
||||
* @typedef {Object} Partial
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the possible options for a WebEmbed
|
||||
* @typedef {Object} WebEmbedOptions
|
||||
* @property {string} [title] The title of this embed
|
||||
* @property {string} [description] The description of this embed
|
||||
* @property {string} [url] The URL of this embed
|
||||
* @property {ColorResolvable} [color] The color of this embed
|
||||
* @property {Partial<WebEmbedAuthor>} [author] The author of this embed
|
||||
* @property {Partial<WebEmbedThumbnail>} [thumbnail] The thumbnail of this embed
|
||||
* @property {Partial<WebEmbedImage>} [image] The image of this embed
|
||||
* @property {Partial<WebEmbedVideo>} [video] The video of this embed
|
||||
* @property {Partial<WebEmbedFooter>} [footer] The footer of this embed
|
||||
* @property {Partial<WebEmbedProvider>} [provider] The provider of this embed
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line valid-jsdoc
|
||||
/**
|
||||
* @param {WebEmbed|WebEmbedOptions|APIEmbed} [data={}] WebEmbed to clone or raw embed data
|
||||
*/
|
||||
this._setup(data);
|
||||
/**
|
||||
* Shorten the link
|
||||
@ -56,8 +85,8 @@ class WebEmbed {
|
||||
this.color = 'color' in data ? Util.resolveColor(data.color) : null;
|
||||
|
||||
/**
|
||||
* Represents the image of a MessageEmbed
|
||||
* @typedef {Object} MessageEmbedImage
|
||||
* Represents the image of a WebEmbed
|
||||
* @typedef {Object} WebEmbedImage
|
||||
* @property {string} url URL for this image
|
||||
* @property {string} proxyURL ProxyURL for this image
|
||||
* @property {number} height Height of this image
|
||||
@ -66,7 +95,7 @@ class WebEmbed {
|
||||
|
||||
/**
|
||||
* The image of this embed, if there is one
|
||||
* @type {?MessageEmbedImage}
|
||||
* @type {?WebEmbedImage}
|
||||
*/
|
||||
this.image = data.image
|
||||
? {
|
||||
@ -79,7 +108,7 @@ class WebEmbed {
|
||||
|
||||
/**
|
||||
* The thumbnail of this embed (if there is one)
|
||||
* @type {?MessageEmbedThumbnail}
|
||||
* @type {?WebEmbedThumbnail}
|
||||
*/
|
||||
this.thumbnail = data.thumbnail
|
||||
? {
|
||||
@ -91,8 +120,8 @@ class WebEmbed {
|
||||
: null;
|
||||
|
||||
/**
|
||||
* Represents the video of a MessageEmbed
|
||||
* @typedef {Object} MessageEmbedVideo
|
||||
* Represents the video of a WebEmbed
|
||||
* @typedef {Object} WebEmbedVideo
|
||||
* @property {string} url URL of this video
|
||||
* @property {string} proxyURL ProxyURL for this video
|
||||
* @property {number} height Height of this video
|
||||
@ -101,7 +130,7 @@ class WebEmbed {
|
||||
|
||||
/**
|
||||
* The video of this embed (if there is one)
|
||||
* @type {?MessageEmbedVideo}
|
||||
* @type {?WebEmbedVideo}
|
||||
* @readonly
|
||||
*/
|
||||
this.video = data.video
|
||||
@ -114,8 +143,8 @@ class WebEmbed {
|
||||
: null;
|
||||
|
||||
/**
|
||||
* Represents the author field of a MessageEmbed
|
||||
* @typedef {Object} MessageEmbedAuthor
|
||||
* Represents the author field of a WebEmbed
|
||||
* @typedef {Object} WebEmbedAuthor
|
||||
* @property {string} name The name of this author
|
||||
* @property {string} url URL of this author
|
||||
* @property {string} iconURL URL of the icon for this author
|
||||
@ -124,7 +153,7 @@ class WebEmbed {
|
||||
|
||||
/**
|
||||
* The author of this embed (if there is one)
|
||||
* @type {?MessageEmbedAuthor}
|
||||
* @type {?WebEmbedAuthor}
|
||||
*/
|
||||
this.author = data.author
|
||||
? {
|
||||
@ -134,15 +163,15 @@ class WebEmbed {
|
||||
: null;
|
||||
|
||||
/**
|
||||
* Represents the provider of a MessageEmbed
|
||||
* @typedef {Object} MessageEmbedProvider
|
||||
* Represents the provider of a WebEmbed
|
||||
* @typedef {Object} WebEmbedProvider
|
||||
* @property {string} name The name of this provider
|
||||
* @property {string} url URL of this provider
|
||||
*/
|
||||
|
||||
/**
|
||||
* The provider of this embed (if there is one)
|
||||
* @type {?MessageEmbedProvider}
|
||||
* @type {?WebEmbedProvider}
|
||||
*/
|
||||
this.provider = data.provider
|
||||
? {
|
||||
@ -152,7 +181,7 @@ class WebEmbed {
|
||||
: null;
|
||||
}
|
||||
/**
|
||||
* The options to provide for setting an author for a {@link MessageEmbed}.
|
||||
* The options to provide for setting an author for a {@link WebEmbed}.
|
||||
* @typedef {Object} EmbedAuthorData
|
||||
* @property {string} name The name of this author.
|
||||
*/
|
||||
@ -161,7 +190,7 @@ class WebEmbed {
|
||||
* Sets the author of this embed.
|
||||
* @param {string|EmbedAuthorData|null} options The options to provide for the author.
|
||||
* Provide `null` to remove the author data.
|
||||
* @returns {MessageEmbed}
|
||||
* @returns {WebEmbed}
|
||||
*/
|
||||
setAuthor(options) {
|
||||
if (options === null) {
|
||||
@ -177,7 +206,7 @@ class WebEmbed {
|
||||
}
|
||||
|
||||
/**
|
||||
* The options to provide for setting an provider for a {@link MessageEmbed}.
|
||||
* The options to provide for setting an provider for a {@link WebEmbed}.
|
||||
* @typedef {Object} EmbedProviderData
|
||||
* @property {string} name The name of this provider.
|
||||
*/
|
||||
@ -186,7 +215,7 @@ class WebEmbed {
|
||||
* Sets the provider of this embed.
|
||||
* @param {string|EmbedProviderData|null} options The options to provide for the provider.
|
||||
* Provide `null` to remove the provider data.
|
||||
* @returns {MessageEmbed}
|
||||
* @returns {WebEmbed}
|
||||
*/
|
||||
setProvider(options) {
|
||||
if (options === null) {
|
||||
@ -204,7 +233,7 @@ class WebEmbed {
|
||||
/**
|
||||
* Sets the color of this embed.
|
||||
* @param {ColorResolvable} color The color of the embed
|
||||
* @returns {MessageEmbed}
|
||||
* @returns {WebEmbed}
|
||||
*/
|
||||
setColor(color) {
|
||||
this.color = Util.resolveColor(color);
|
||||
@ -214,7 +243,7 @@ class WebEmbed {
|
||||
/**
|
||||
* Sets the description of this embed.
|
||||
* @param {string} description The description (Limit 350 characters)
|
||||
* @returns {MessageEmbed}
|
||||
* @returns {WebEmbed}
|
||||
*/
|
||||
setDescription(description) {
|
||||
this.description = Util.verifyString(description, RangeError, 'EMBED_DESCRIPTION');
|
||||
@ -224,7 +253,7 @@ class WebEmbed {
|
||||
/**
|
||||
* Sets the image of this embed.
|
||||
* @param {string} url The URL of the image
|
||||
* @returns {MessageEmbed}
|
||||
* @returns {WebEmbed}
|
||||
*/
|
||||
setImage(url) {
|
||||
if (this.thumbnail && this.thumbnail.url) {
|
||||
@ -239,7 +268,7 @@ class WebEmbed {
|
||||
/**
|
||||
* Sets the thumbnail of this embed.
|
||||
* @param {string} url The URL of the image
|
||||
* @returns {MessageEmbed}
|
||||
* @returns {WebEmbed}
|
||||
*/
|
||||
setThumbnail(url) {
|
||||
if (this.image && this.image.url) {
|
||||
@ -254,7 +283,7 @@ class WebEmbed {
|
||||
/**
|
||||
* Sets the video of this embed.
|
||||
* @param {string} url The URL of the video
|
||||
* @returns {MessageEmbed}
|
||||
* @returns {WebEmbed}
|
||||
*/
|
||||
setVideo(url) {
|
||||
this.video = { url };
|
||||
@ -264,7 +293,7 @@ class WebEmbed {
|
||||
/**
|
||||
* Sets the title of this embed.
|
||||
* @param {string} title The title
|
||||
* @returns {MessageEmbed}
|
||||
* @returns {WebEmbed}
|
||||
*/
|
||||
setTitle(title) {
|
||||
this.title = Util.verifyString(title, RangeError, 'EMBED_TITLE');
|
||||
@ -274,7 +303,7 @@ class WebEmbed {
|
||||
/**
|
||||
* Sets the URL of this embed.
|
||||
* @param {string} url The URL
|
||||
* @returns {MessageEmbed}
|
||||
* @returns {WebEmbed}
|
||||
*/
|
||||
setURL(url) {
|
||||
this.url = url;
|
||||
|
@ -30,6 +30,12 @@ const listUserAgent = [
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_3_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 Edg/100.0.1185.39',
|
||||
];
|
||||
|
||||
exports.NitroState = {
|
||||
0: 'NONE',
|
||||
1: 'CLASSIC',
|
||||
2: 'BOOST',
|
||||
};
|
||||
|
||||
exports.DMScanLevel = {
|
||||
0: 'NOT_SCAN',
|
||||
1: 'NOT_FRIEND',
|
||||
|
@ -34,6 +34,9 @@ const JSONBig = require('json-bigint');
|
||||
* @property {number|number[]|string} [shards] The shard's id to run, or an array of shard ids. If not specified,
|
||||
* the client will spawn {@link ClientOptions#shardCount} shards. If set to `auto`, it will fetch the
|
||||
* recommended amount of shards from Discord and spawn that amount
|
||||
* @property {boolean} [checkUpdate=true] Check for module updates at startup
|
||||
* @property {boolean} [readyStatus=true] Sync state with Discord Client
|
||||
* @property {boolean} [autoCookie=true] Automatically add Cookies to Request on startup
|
||||
* @property {number} [shardCount=1] The total amount of shards used by all processes of this bot
|
||||
* (e.g. recommended shard count, shard count of the ShardingManager)
|
||||
* @property {CacheFactory} [makeCache] Function to create a cache.
|
||||
@ -49,7 +52,7 @@ const JSONBig = require('json-bigint');
|
||||
* @property {number} [invalidRequestWarningInterval=0] The number of invalid REST requests (those that return
|
||||
* 401, 403, or 429) in a 10 minute window between emitted warnings (0 for no warnings). That is, if set to 500,
|
||||
* warnings will be emitted at invalid request number 500, 1000, 1500, and so on.
|
||||
* @property {PartialType[]} [partials] Structures allowed to be partial. This means events can be emitted even when
|
||||
* @property {PartialType[]} [partials=['USER', 'CHANNEL', 'GUILD_MEMBER', 'MESSAGE', 'REACTION', 'GUILD_SCHEDULED_EVENT']] Structures allowed to be partial. This means events can be emitted even when
|
||||
* they're missing all the data for a particular structure. See the "Partial Structures" topic on the
|
||||
* [guide](https://discordjs.guide/popular-topics/partials.html) for some
|
||||
* important usage information, as partials require you to put checks in place when handling data.
|
||||
@ -72,7 +75,7 @@ const JSONBig = require('json-bigint');
|
||||
* @property {string[]} [userAgentSuffix] An array of additional bot info to be appended to the end of the required
|
||||
* [User Agent](https://discord.com/developers/docs/reference#user-agent) header
|
||||
* @property {PresenceData} [presence={}] Presence data to use upon login
|
||||
* @property {IntentsResolvable} intents Intents to enable for this connection
|
||||
* @property {IntentsResolvable} [intents] Intents to enable for this connection
|
||||
* @property {number} [waitGuildTimeout=15_000] Time in milliseconds that Clients with the GUILDS intent should wait for
|
||||
* missing guilds to be recieved before starting the bot. If not specified, the default is 15 seconds.
|
||||
* @property {SweeperOptions} [sweepers={}] Options for cache sweeping
|
||||
|
Loading…
Reference in New Issue
Block a user