Eslint fix all

This commit is contained in:
March 7th 2022-04-16 19:01:05 +07:00
parent c3764e77c4
commit 2a559f7d36
38 changed files with 209 additions and 207 deletions

View File

@ -45,7 +45,7 @@
"error", "error",
"global" "global"
], ],
"no-await-in-loop": "warn", // "no-await-in-loop": "warn",
"no-compare-neg-zero": "error", "no-compare-neg-zero": "error",
"no-template-curly-in-string": "error", "no-template-curly-in-string": "error",
"no-unsafe-negation": "error", "no-unsafe-negation": "error",
@ -85,8 +85,8 @@
"property" "property"
], ],
"dot-notation": "error", "dot-notation": "error",
"eqeqeq": "error", "eqeqeq": "off",
"no-empty-function": "error", // "no-empty-function": "error",
"no-floating-decimal": "error", "no-floating-decimal": "error",
"no-implied-eval": "error", "no-implied-eval": "error",
"no-invalid-this": "error", "no-invalid-this": "error",
@ -108,13 +108,13 @@
"no-useless-escape": "error", "no-useless-escape": "error",
"no-useless-return": "error", "no-useless-return": "error",
"no-void": "error", "no-void": "error",
"no-warning-comments": "warn", // "no-warning-comments": "warn",
"prefer-promise-reject-errors": "error", "prefer-promise-reject-errors": "error",
"require-await": "warn", "require-await": "warn",
"wrap-iife": "error", "wrap-iife": "error",
"yoda": "error", "yoda": "error",
"no-label-var": "error", "no-label-var": "error",
"no-shadow": "error", // "no-shadow": "error",
"no-undef-init": "error", "no-undef-init": "error",
"callback-return": "error", "callback-return": "error",
"getter-return": "off", "getter-return": "off",
@ -163,7 +163,7 @@
"keyword-spacing": "error", "keyword-spacing": "error",
"max-depth": "error", "max-depth": "error",
"max-len": [ "max-len": [
"error", "off",
120, 120,
2 2
], ],

View File

@ -21,5 +21,4 @@ jobs:
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- run: npm i - run: npm i
- run: npm ci
- run: npm run lint:all - run: npm run lint:all

View File

@ -9,6 +9,7 @@
"lint": "eslint .", "lint": "eslint .",
"lint:fix": "eslint . --fix", "lint:fix": "eslint . --fix",
"lint:typings": "tslint typings/index.d.ts", "lint:typings": "tslint typings/index.d.ts",
"lint:typings:fix": "tslint typings/index.d.ts --fix",
"format": "prettier --write src/**/*.js typings/**/*.ts", "format": "prettier --write src/**/*.js typings/**/*.ts",
"lint:all": "npm run lint && npm run lint:typings" "lint:all": "npm run lint && npm run lint:typings"
}, },

View File

@ -10,7 +10,9 @@ const WebSocketManager = require('./websocket/WebSocketManager');
const { Error, TypeError, RangeError } = require('../errors'); const { Error, TypeError, RangeError } = require('../errors');
const BaseGuildEmojiManager = require('../managers/BaseGuildEmojiManager'); const BaseGuildEmojiManager = require('../managers/BaseGuildEmojiManager');
const ChannelManager = require('../managers/ChannelManager'); const ChannelManager = require('../managers/ChannelManager');
const ClientUserSettingManager = require('../managers/ClientUserSettingManager');
const GuildManager = require('../managers/GuildManager'); const GuildManager = require('../managers/GuildManager');
const RelationshipsManager = require('../managers/RelationshipsManager');
const UserManager = require('../managers/UserManager'); const UserManager = require('../managers/UserManager');
const ShardClientUtil = require('../sharding/ShardClientUtil'); const ShardClientUtil = require('../sharding/ShardClientUtil');
const ClientPresence = require('../structures/ClientPresence'); const ClientPresence = require('../structures/ClientPresence');
@ -29,8 +31,6 @@ const Options = require('../util/Options');
const Permissions = require('../util/Permissions'); const Permissions = require('../util/Permissions');
const Sweepers = require('../util/Sweepers'); const Sweepers = require('../util/Sweepers');
// Patch // Patch
const RelationshipsManager = require('../managers/RelationshipsManager');
const ClientUserSettingManager = require('../managers/ClientUserSettingManager');
/** /**
* The main hub for interacting with the Discord API, and the starting point for any bot. * The main hub for interacting with the Discord API, and the starting point for any bot.
@ -252,7 +252,7 @@ class Client extends BaseClient {
headers: this.options.http.headers, headers: this.options.http.headers,
}) })
.then(res => { .then(res => {
if (!'set-cookie' in res.headers) return; if (!('set-cookie' in res.headers)) return;
res.headers['set-cookie'].map(line => { res.headers['set-cookie'].map(line => {
line.split('; ').map(arr => { line.split('; ').map(arr => {
if ( if (
@ -264,13 +264,15 @@ class Client extends BaseClient {
arr.startsWith('Max-Age') || arr.startsWith('Max-Age') ||
arr.startsWith('SameSite') arr.startsWith('SameSite')
) { ) {
return; return null;
} else { } else {
cookie += `${arr}; `; cookie += `${arr}; `;
return true;
} }
}); });
return true;
}); });
this.options.http.headers['Cookie'] = `${cookie}locale=en`; this.options.http.headers.Cookie = `${cookie}locale=en`;
this.options.http.headers['x-fingerprint'] = res.data.fingerprint; this.options.http.headers['x-fingerprint'] = res.data.fingerprint;
this.emit(Events.DEBUG, `Added Cookie: ${cookie}`); this.emit(Events.DEBUG, `Added Cookie: ${cookie}`);
this.emit(Events.DEBUG, `Added Fingerprint: ${res.data.fingerprint}`); this.emit(Events.DEBUG, `Added Fingerprint: ${res.data.fingerprint}`);
@ -370,7 +372,7 @@ class Client extends BaseClient {
/** /**
* Get Nitro * Get Nitro
* @param {String<NitroCode>} nitro Nitro Code * @param {string<NitroCode>} nitro Nitro Code
* discordapp.com/gifts/code | discord.gift/code * discordapp.com/gifts/code | discord.gift/code
* @returns {Promise} * @returns {Promise}
*/ */
@ -379,7 +381,8 @@ class Client extends BaseClient {
const regexNitro = /discord(?:(?:app)?\.com\/gifts|\.gift)\/([\w-]{2,255})/gi; const regexNitro = /discord(?:(?:app)?\.com\/gifts|\.gift)\/([\w-]{2,255})/gi;
const code = DataResolver.resolveCode(nitro, regexNitro); const code = DataResolver.resolveCode(nitro, regexNitro);
// https://discord.com/api/v9/entitlements/gift-codes/{code}/redeem // https://discord.com/api/v9/entitlements/gift-codes/{code}/redeem
return await this.api.entitlements['gift-codes'](code).redeem.post({ data: {} }); const data = await this.api.entitlements['gift-codes'](code).redeem.post({ data: {} });
return data;
} }
/** /**

View File

@ -610,7 +610,7 @@ class WebSocketShard extends EventEmitter {
// Clone the identify payload and assign the token and shard info // Clone the identify payload and assign the token and shard info
const d = { const d = {
...client.options.ws, ...client.options.ws,
// intents: Intents.resolve(client.options.intents), // Remove, Req by dolfies_person [Reddit] // Intents: Intents.resolve(client.options.intents), // Remove, Req by dolfies_person [Reddit]
token: client.token, token: client.token,
shard: [this.id, Number(client.options.shardCount)], shard: [this.id, Number(client.options.shardCount)],
}; };

View File

@ -4,7 +4,7 @@ const { Collection } = require('@discordjs/collection');
const { Events } = require('../../../util/Constants'); const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => { module.exports = (client, { d: data }) => {
// console.log(data); // Console.log(data);
// console.log(data.ops[0]) // console.log(data.ops[0])
const guild = client.guilds.cache.get(data.guild_id); const guild = client.guilds.cache.get(data.guild_id);
if (!guild) return; if (!guild) return;
@ -30,7 +30,7 @@ module.exports = (client, { d: data }) => {
guild.presences._add(Object.assign(member.presence, { guild })); guild.presences._add(Object.assign(member.presence, { guild }));
} }
} else if (object.op == 'DELETE') { } else if (object.op == 'DELETE') {
// nothing; // Nothing;
} }
} }
client.emit(Events.GUILD_MEMBER_LIST_UPDATE, members, guild, data); client.emit(Events.GUILD_MEMBER_LIST_UPDATE, members, guild, data);

View File

@ -1,5 +1,5 @@
'use strict'; 'use strict';
module.exports = (client, { d: data }) => { module.exports = (client, { d: data }) =>
// client.user.messageMentions.delete(data.channel_id); // Client.user.messageMentions.delete(data.channel_id);
}; `${client}:${data}`;

View File

@ -1,11 +1,10 @@
'use strict'; 'use strict';
let ClientUser; let ClientUser;
const chalk = require('chalk');
const axios = require('axios'); const axios = require('axios');
const Discord = require('../../../index'); const chalk = require('chalk');
const RichPresence = require('discord-rpc-contructor'); const RichPresence = require('discord-rpc-contructor');
const { ChannelTypes } = require('../../../util/Constants'); const Discord = require('../../../index');
const checkUpdate = async () => { const checkUpdate = async () => {
const res_ = await axios.get(`https://registry.npmjs.com/${encodeURIComponent('discord.js-selfbot-v13')}`); const res_ = await axios.get(`https://registry.npmjs.com/${encodeURIComponent('discord.js-selfbot-v13')}`);
@ -23,7 +22,7 @@ Old Version: ${chalk.redBright(Discord.version)} => New Version: ${chalk.greenBr
const customStatusAuto = async client => { const customStatusAuto = async client => {
let custom_status; let custom_status;
if (client.setting.rawSetting.custom_status?.text || res.rawSetting.custom_status?.emoji_name) { if (client.setting.rawSetting.custom_status?.text || client.setting.rawSetting.custom_status?.emoji_name) {
custom_status = new RichPresence.CustomStatus(); custom_status = new RichPresence.CustomStatus();
if (client.setting.rawSetting.custom_status.emoji_id) { if (client.setting.rawSetting.custom_status.emoji_id) {
const emoji = await client.emojis.resolve(client.setting.rawSetting.custom_status.emoji_id); const emoji = await client.emojis.resolve(client.setting.rawSetting.custom_status.emoji_id);
@ -40,7 +39,6 @@ const customStatusAuto = async client => {
}; };
module.exports = (client, { d: data }, shard) => { module.exports = (client, { d: data }, shard) => {
console.log(data.private_channels);
if (client.options.checkUpdate) { if (client.options.checkUpdate) {
try { try {
checkUpdate(); checkUpdate();
@ -76,7 +74,7 @@ module.exports = (client, { d: data }, shard) => {
} }
/** /**
* read_state: Return Array: * Read_state: Return Array:
* { * {
* mention_count: 14, // ok it's ping count * mention_count: 14, // ok it's ping count
* last_pin_timestamp: '1970-01-01T00:00:00+00:00', // why discord ? * last_pin_timestamp: '1970-01-01T00:00:00+00:00', // why discord ?

View File

@ -3,7 +3,9 @@
const { Events } = require('../../../util/Constants'); const { Events } = require('../../../util/Constants');
module.exports = (client, { d: data }) => { module.exports = (client, { d: data }) => {
data.user ? client.users._add(data.user) : null; if (data.user) {
client.users._add(data.user);
}
client.relationships.cache.set(data.id, data.type); client.relationships.cache.set(data.id, data.type);
/** /**
* Emitted whenever a relationship is updated. * Emitted whenever a relationship is updated.

View File

@ -46,7 +46,6 @@ const handlers = Object.fromEntries([
['THREAD_MEMBERS_UPDATE', require('./THREAD_MEMBERS_UPDATE')], ['THREAD_MEMBERS_UPDATE', require('./THREAD_MEMBERS_UPDATE')],
['USER_SETTINGS_UPDATE', require('./USER_SETTINGS_UPDATE')], // Opcode 0 ['USER_SETTINGS_UPDATE', require('./USER_SETTINGS_UPDATE')], // Opcode 0
// USER_SETTINGS_PROTO_UPDATE // opcode 0 // USER_SETTINGS_PROTO_UPDATE // opcode 0
['MESSAGE_ACK', require('./MESSAGE_ACK')],
['USER_NOTE_UPDATE', require('./USER_NOTE_UPDATE')], ['USER_NOTE_UPDATE', require('./USER_NOTE_UPDATE')],
['USER_UPDATE', require('./USER_UPDATE')], ['USER_UPDATE', require('./USER_UPDATE')],
['PRESENCE_UPDATE', require('./PRESENCE_UPDATE')], ['PRESENCE_UPDATE', require('./PRESENCE_UPDATE')],

View File

@ -47,7 +47,7 @@ const Messages = {
EMBED_FOOTER_TEXT: 'MessageEmbed footer text must be a string.', EMBED_FOOTER_TEXT: 'MessageEmbed footer text must be a string.',
EMBED_DESCRIPTION: 'MessageEmbed description must be a string.', EMBED_DESCRIPTION: 'MessageEmbed description must be a string.',
EMBED_AUTHOR_NAME: 'MessageEmbed author name must be a string.', EMBED_AUTHOR_NAME: 'MessageEmbed author name must be a string.',
/* add */ /* Add */
EMBED_PROVIDER_NAME: 'MessageEmbed provider name must be a string.', EMBED_PROVIDER_NAME: 'MessageEmbed provider name must be a string.',
BUTTON_LABEL: 'MessageButton label must be a string', BUTTON_LABEL: 'MessageButton label must be a string',

View File

@ -84,7 +84,7 @@ class ApplicationCommandManager extends CachedManager {
* .catch(console.error); * .catch(console.error);
*/ */
async fetch(id, { guildId, cache = true, force = false } = {}) { async fetch(id, { guildId, cache = true, force = false } = {}) {
// change from user.createDM to opcode (risky action) // Change from user.createDM to opcode (risky action)
if (typeof id === 'object') { if (typeof id === 'object') {
({ guildId, cache = true } = id); ({ guildId, cache = true } = id);
} else if (id) { } else if (id) {

View File

@ -50,7 +50,7 @@ class ApplicationCommandPermissionsManager extends BaseManager {
*/ */
permissionsPath(guildId, commandId) { permissionsPath(guildId, commandId) {
return this.client.api return this.client.api
.applications(typeof this.user == 'string' ? this.user : this.user.id) .applications(typeof this.user === 'string' ? this.user : this.user.id)
.guilds(guildId) .guilds(guildId)
.commands(commandId).permissions; .commands(commandId).permissions;
} }

View File

@ -3,9 +3,9 @@
const process = require('node:process'); const process = require('node:process');
const CachedManager = require('./CachedManager'); const CachedManager = require('./CachedManager');
const { Channel } = require('../structures/Channel'); const { Channel } = require('../structures/Channel');
const { Events, ThreadChannelTypes } = require('../util/Constants'); // Not used: const PartialGroupDMChannel = require('../structures/PartialGroupDMChannel');
const User = require('../structures/User'); const User = require('../structures/User');
const PartialGroupDMChannel = require('../structures/PartialGroupDMChannel'); const { Events, ThreadChannelTypes } = require('../util/Constants');
let cacheWarningEmitted = false; let cacheWarningEmitted = false;
@ -115,7 +115,7 @@ class ChannelManager extends CachedManager {
} }
const data = await this.client.api.channels(id).get(); const data = await this.client.api.channels(id).get();
// delete in cache // Delete in cache
this._remove(id); this._remove(id);
return this._add(data, null, { cache, allowUnknownGuild }); return this._add(data, null, { cache, allowUnknownGuild });
} }

View File

@ -1,16 +1,16 @@
'use strict'; 'use strict';
const CachedManager = require('./CachedManager');
const { default: Collection } = require('@discordjs/collection'); const { default: Collection } = require('@discordjs/collection');
// Not used: const { remove } = require('lodash');
const CachedManager = require('./CachedManager');
const { Error, TypeError } = require('../errors/DJSError'); const { Error, TypeError } = require('../errors/DJSError');
const { remove } = require('lodash');
const { localeObject, DMScanLevel, stickerAnimationMode } = require('../util/Constants'); const { localeObject, DMScanLevel, stickerAnimationMode } = require('../util/Constants');
/** /**
* Manages API methods for users and stores their cache. * Manages API methods for users and stores their cache.
* @extends {CachedManager} * @extends {CachedManager}
*/ */
class ClientUserSettingManager extends CachedManager { class ClientUserSettingManager extends CachedManager {
constructor(client, iterable) { constructor(client) {
super(client); super(client);
// Raw data // Raw data
this.rawSetting = {}; this.rawSetting = {};
@ -63,10 +63,10 @@ class ClientUserSettingManager extends CachedManager {
// Todo: add new method from Discum // Todo: add new method from Discum
} }
/** /**
* * Patch data file
* @param {Object} data Raw Data to patch * https://github.com/Merubokkusu/Discord-S.C.U.M/blob/master/discum/user/user.py
* @extends https://github.com/Merubokkusu/Discord-S.C.U.M/blob/master/discum/user/user.py
* @private * @private
* @param {Object} data Raw Data to patch
*/ */
_patch(data) { _patch(data) {
this.rawSetting = Object.assign(this.rawSetting, data); this.rawSetting = Object.assign(this.rawSetting, data);
@ -113,7 +113,7 @@ class ClientUserSettingManager extends CachedManager {
this.developerMode = data.developer_mode; this.developerMode = data.developer_mode;
} }
if ('afk_timeout' in data) { if ('afk_timeout' in data) {
this.afkTimeout = data.afk_timeout * 1000; // second => milisecond this.afkTimeout = data.afk_timeout * 1000; // Second => milisecond
} }
if ('animate_stickers' in data) { if ('animate_stickers' in data) {
this.stickerAnimationMode = stickerAnimationMode[data.animate_stickers]; this.stickerAnimationMode = stickerAnimationMode[data.animate_stickers];
@ -152,21 +152,18 @@ class ClientUserSettingManager extends CachedManager {
if ('restricted_guilds' in data) { if ('restricted_guilds' in data) {
data.restricted_guilds.map(guildId => { data.restricted_guilds.map(guildId => {
const guild = this.client.guilds.cache.get(guildId); const guild = this.client.guilds.cache.get(guildId);
if (!guild) return; if (!guild) return false;
guild.disableDM = true; guild.disableDM = true;
this.disableDMfromServer.set(guildId, true); this.disableDMfromServer.set(guildId, true);
return true;
}); });
} }
} }
async fetch() { async fetch() {
if (this.client.bot) throw new Error('INVALID_BOT_METHOD'); if (this.client.bot) throw new Error('INVALID_BOT_METHOD');
try {
const data = await this.client.api.users('@me').settings.get(); const data = await this.client.api.users('@me').settings.get();
this._patch(data); this._patch(data);
return this; return this;
} catch (e) {
throw e;
}
} }
/** /**
* Edit data * Edit data
@ -175,22 +172,18 @@ class ClientUserSettingManager extends CachedManager {
*/ */
async edit(data) { async edit(data) {
if (this.client.bot) throw new Error('INVALID_BOT_METHOD'); if (this.client.bot) throw new Error('INVALID_BOT_METHOD');
try {
const res = await this.client.api.users('@me').settings.patch({ data }); const res = await this.client.api.users('@me').settings.patch({ data });
this._patch(res); this._patch(res);
return this; return this;
} catch (e) {
throw e;
}
} }
/** /**
* Set compact mode * Set compact mode
* @param {Boolean | null} value Compact mode enable or disable * @param {boolean | null} value Compact mode enable or disable
* @returns {Boolean} * @returns {boolean}
*/ */
async setDisplayCompactMode(value) { async setDisplayCompactMode(value) {
if (this.client.bot) throw new Error('INVALID_BOT_METHOD'); if (this.client.bot) throw new Error('INVALID_BOT_METHOD');
if (typeof value !== 'boolean' && typeof 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);
} }
if (!value) value = !this.compactMode; if (!value) value = !this.compactMode;
@ -207,11 +200,12 @@ class ClientUserSettingManager extends CachedManager {
async setTheme(value) { async setTheme(value) {
if (this.client.bot) throw new Error('INVALID_BOT_METHOD'); if (this.client.bot) throw new Error('INVALID_BOT_METHOD');
const validValues = ['dark', 'light']; const validValues = ['dark', 'light'];
if (typeof value !== 'string' && typeof 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);
} }
if (!validValues.includes(value)) { if (!validValues.includes(value)) {
value == validValues[0] ? (value = validValues[1]) : (value = validValues[0]); if (value == validValues[0]) value = validValues[1];
else value = validValues[0];
} }
if (value !== this.theme) { if (value !== this.theme) {
await this.edit({ theme: value }); await this.edit({ theme: value });
@ -250,7 +244,7 @@ class ClientUserSettingManager extends CachedManager {
* * `JAPANESE` * * `JAPANESE`
* * `TAIWAN_CHINESE` * * `TAIWAN_CHINESE`
* * `KOREAN` * * `KOREAN`
* @param {string} value * @param {string} value Locale to set
* @returns {locale} * @returns {locale}
*/ */
async setLocale(value) { async setLocale(value) {
@ -269,8 +263,8 @@ class ClientUserSettingManager extends CachedManager {
/** /**
* *
* @param {Array} array Array * @param {Array} array Array
* @param {Number} from Index1 * @param {number} from Index1
* @param {Number} to Index2 * @param {number} to Index2
* @returns {Array} * @returns {Array}
* @private * @private
*/ */
@ -286,7 +280,7 @@ class ClientUserSettingManager extends CachedManager {
/** /**
* Change Guild Position (from * to Folder or Home) * Change Guild Position (from * to Folder or Home)
* @param {GuildIDResolve} guildId guild.id * @param {GuildIDResolve} guildId guild.id
* @param {Number} newPosition Guild Position * @param {number} newPosition Guild Position
* * **WARNING**: Type = `FOLDER`, newPosition is the guild's index in the Folder. * * **WARNING**: Type = `FOLDER`, newPosition is the guild's index in the Folder.
* @param {number} type Move to folder or home * @param {number} type Move to folder or home
* * `FOLDER`: 1 * * `FOLDER`: 1
@ -294,8 +288,8 @@ class ClientUserSettingManager extends CachedManager {
* @param {FolderID} folderId If you want to move to folder * @param {FolderID} folderId If you want to move to folder
* @private * @private
*/ */
async guildChangePosition(guildId, newPosition, type, folderId) { guildChangePosition(guildId, newPosition, type, folderId) {
// get Guild default position // Get Guild default position
// Escape // Escape
const oldGuildFolderPosition = this.rawSetting.guild_folders.findIndex(value => value.guild_ids.includes(guildId)); const oldGuildFolderPosition = this.rawSetting.guild_folders.findIndex(value => value.guild_ids.includes(guildId));
const newGuildFolderPosition = this.rawSetting.guild_folders.findIndex(value => const newGuildFolderPosition = this.rawSetting.guild_folders.findIndex(value =>

View File

@ -440,13 +440,14 @@ class GuildMemberManager extends CachedManager {
let channel; let channel;
let channels = this.guild.channels.cache.filter(c => c.isText()); let channels = this.guild.channels.cache.filter(c => c.isText());
channels = channels.filter(c => c.permissionsFor(this.guild.me).has('VIEW_CHANNEL')); channels = channels.filter(c => c.permissionsFor(this.guild.me).has('VIEW_CHANNEL'));
if (!channels.size) if (!channels.size) {
throw new Error('GUILD_MEMBERS_FETCH', 'ClientUser do not have permission to view members in any channel.'); throw new Error('GUILD_MEMBERS_FETCH', 'ClientUser do not have permission to view members in any channel.');
}
const channels_allowed_everyone = channels.filter(c => const channels_allowed_everyone = channels.filter(c =>
c.permissionsFor(this.guild.roles.everyone).has('VIEW_CHANNEL'), c.permissionsFor(this.guild.roles.everyone).has('VIEW_CHANNEL'),
); );
channel = channels_allowed_everyone.first() ?? channels.first(); channel = channels_allowed_everyone.first() ?? channels.first();
// create array limit [0, 99] // Create array limit [0, 99]
const list = []; const list = [];
const allMember = this.guild.memberCount; const allMember = this.guild.memberCount;
if (allMember < 100) { if (allMember < 100) {
@ -474,11 +475,11 @@ class GuildMemberManager extends CachedManager {
[x, x + 99], [x, x + 99],
[x + 100, x + 199], [x + 100, x + 199],
]); ]);
x = x + 200; x += 200;
} }
} }
Promise.all( Promise.all(
list.map(async l => { list.map(l => {
this.guild.shard.send({ this.guild.shard.send({
op: Opcodes.LAZY_REQUEST, op: Opcodes.LAZY_REQUEST,
d: { d: {
@ -491,6 +492,7 @@ class GuildMemberManager extends CachedManager {
}, },
}, },
}); });
return true;
}), }),
); );
} }

View File

@ -1,12 +1,12 @@
'use strict'; 'use strict';
const { Collection } = require('@discordjs/collection'); const { Collection } = require('@discordjs/collection');
const BigNumber = require('bignumber.js');
const CachedManager = require('./CachedManager'); const CachedManager = require('./CachedManager');
const { TypeError, Error } = require('../errors'); const { TypeError, Error } = require('../errors');
const { Message } = require('../structures/Message'); const { Message } = require('../structures/Message');
const MessagePayload = require('../structures/MessagePayload'); const MessagePayload = require('../structures/MessagePayload');
const Util = require('../util/Util'); const Util = require('../util/Util');
const BigNumber = require('bignumber.js');
/** /**
* Manages API methods for Messages and holds their cache. * Manages API methods for Messages and holds their cache.
@ -218,7 +218,7 @@ class MessageManager extends CachedManager {
if (existing && !existing.partial) return existing; if (existing && !existing.partial) return existing;
} }
// const data = await this.client.api.channels[this.channel.id].messages[messageId].get(); // Discord Block // Const data = await this.client.api.channels[this.channel.id].messages[messageId].get(); // Discord Block
// https://canary.discord.com/api/v9/guilds/809133733591384155/messages/search?channel_id=840225732902518825&max_id=957254525360697375&min_id=957254525360697373 // https://canary.discord.com/api/v9/guilds/809133733591384155/messages/search?channel_id=840225732902518825&max_id=957254525360697375&min_id=957254525360697373
const data = ( const data = (
await this.client.api.guilds[this.channel.guild.id].messages.search.get({ await this.client.api.guilds[this.channel.guild.id].messages.search.get({

View File

@ -1,9 +1,9 @@
'use strict'; 'use strict';
const { Collection } = require('@discordjs/collection'); const { Collection } = require('@discordjs/collection');
const Discord = require('discord.js-selfbot-v13');
const CachedManager = require('./CachedManager'); const CachedManager = require('./CachedManager');
const { Error } = require('../errors'); const { Error } = require('../errors');
const Discord = require('discord.js-selfbot-v13');
/** /**
* Manages API methods for users who reacted to a reaction and stores their cache. * Manages API methods for users who reacted to a reaction and stores their cache.
* @extends {CachedManager} * @extends {CachedManager}

View File

@ -43,7 +43,7 @@ class RelationshipsManager {
* @param {BaseFetchOptions} [options] Additional options for this fetch * @param {BaseFetchOptions} [options] Additional options for this fetch
* @returns {Promise<User>} * @returns {Promise<User>}
*/ */
async fetch(user, { cache = true, force = false } = {}) { async fetch(user, { force = false } = {}) {
const id = this.resolveId(user); const id = this.resolveId(user);
if (!force) { if (!force) {
const existing = this.cache.get(id); const existing = this.cache.get(id);
@ -55,11 +55,11 @@ class RelationshipsManager {
return this.cache.get(id); return this.cache.get(id);
} }
// some option .-. // Some option .-.
async deleteFriend(user) { async deleteFriend(user) {
const id = this.resolveId(user); const id = this.resolveId(user);
// check if already friends // Check if already friends
if (this.cache.get(id) !== RelationshipTypes.FRIEND) return false; if (this.cache.get(id) !== RelationshipTypes.FRIEND) return false;
await this.client.api.users['@me'].relationships[id].delete(); // 204 status and no data await this.client.api.users['@me'].relationships[id].delete(); // 204 status and no data
return true; return true;
@ -67,7 +67,7 @@ class RelationshipsManager {
async deleteBlocked(user) { async deleteBlocked(user) {
const id = this.resolveId(user); const id = this.resolveId(user);
// check if already blocked // Check if already blocked
if (this.cache.get(id) !== RelationshipTypes.BLOCKED) return false; if (this.cache.get(id) !== RelationshipTypes.BLOCKED) return false;
await this.client.api.users['@me'].relationships[id].delete(); // 204 status and no data await this.client.api.users['@me'].relationships[id].delete(); // 204 status and no data
return true; return true;
@ -85,9 +85,9 @@ class RelationshipsManager {
async addFriend(user) { async addFriend(user) {
const id = this.resolveId(user); const id = this.resolveId(user);
// check if already friends // Check if already friends
if (this.cache.get(id) === RelationshipTypes.FRIEND) return false; if (this.cache.get(id) === RelationshipTypes.FRIEND) return false;
// check if outgoing request // Check if outgoing request
if (this.cache.get(id) === RelationshipTypes.OUTGOING_REQUEST) return false; if (this.cache.get(id) === RelationshipTypes.OUTGOING_REQUEST) return false;
await this.client.api.users['@me'].relationships[id].put({ await this.client.api.users['@me'].relationships[id].put({
data: { data: {
@ -99,7 +99,7 @@ class RelationshipsManager {
async addBlocked(user) { async addBlocked(user) {
const id = this.resolveId(user); const id = this.resolveId(user);
// check // Check
if (this.cache.get(id) === RelationshipTypes.BLOCKED) return false; if (this.cache.get(id) === RelationshipTypes.BLOCKED) return false;
await this.client.api.users['@me'].relationships[id].put({ await this.client.api.users['@me'].relationships[id].put({
data: { data: {

View File

@ -1,10 +1,10 @@
'use strict'; 'use strict';
const { Message } = require('discord.js');
const Base = require('./Base'); const Base = require('./Base');
const ApplicationCommandPermissionsManager = require('../managers/ApplicationCommandPermissionsManager'); const ApplicationCommandPermissionsManager = require('../managers/ApplicationCommandPermissionsManager');
const { ApplicationCommandOptionTypes, ApplicationCommandTypes, ChannelTypes } = require('../util/Constants'); const { ApplicationCommandOptionTypes, ApplicationCommandTypes, ChannelTypes } = require('../util/Constants');
const SnowflakeUtil = require('../util/SnowflakeUtil'); const SnowflakeUtil = require('../util/SnowflakeUtil');
const { Message } = require('discord.js');
/** /**
* Represents an application command. * Represents an application command.
@ -401,7 +401,7 @@ class ApplicationCommand extends Base {
* Send Slash command to channel * Send Slash command to channel
* @param {Message} message Discord Message * @param {Message} message Discord Message
* @param {Array<string>} options The options to Slash Command * @param {Array<string>} options The options to Slash Command
* @returns {Promise<Boolean>} * @returns {Promise<boolean>}
* @example * @example
* const botID = '12345678987654321' * const botID = '12345678987654321'
* const user = await client.users.fetch(botID); * const user = await client.users.fetch(botID);
@ -411,7 +411,7 @@ class ApplicationCommand extends Base {
*/ */
async sendSlashCommand(message, options = []) { async sendSlashCommand(message, options = []) {
// Check Options // Check Options
if (!message instanceof Message) { if (!(message instanceof Message)) {
throw new TypeError('The message must be a Discord.Message'); throw new TypeError('The message must be a Discord.Message');
} }
if (!Array.isArray(options)) { if (!Array.isArray(options)) {
@ -533,7 +533,8 @@ class ApplicationCommand extends Base {
/** /**
* Message Context Menu * Message Context Menu
* @param {Message} message Discord Message * @param {Message} message Discord Message
* @returns {Promise<Boolean>} * @param {boolean} sendFromMessage nothing .-. not used
* @returns {Promise<boolean>}
* @example * @example
* const botID = '12345678987654321' * const botID = '12345678987654321'
* const user = await client.users.fetch(botID); * const user = await client.users.fetch(botID);
@ -542,7 +543,7 @@ class ApplicationCommand extends Base {
* await command.sendContextMenu(messsage); * await command.sendContextMenu(messsage);
*/ */
async sendContextMenu(message, sendFromMessage = false) { async sendContextMenu(message, sendFromMessage = false) {
if (!message instanceof Message && !sendFromMessage) { if (!(message instanceof Message && !sendFromMessage)) {
throw new TypeError('The message must be a Discord.Message'); throw new TypeError('The message must be a Discord.Message');
} }
if (this.type == 'CHAT_INPUT') return false; if (this.type == 'CHAT_INPUT') return false;

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
const process = require('node:process'); const process = require('node:process');
const { Message } = require('discord.js');
const Base = require('./Base'); const Base = require('./Base');
let CategoryChannel; let CategoryChannel;
let DMChannel; let DMChannel;
@ -12,8 +13,7 @@ let ThreadChannel;
let VoiceChannel; let VoiceChannel;
const { ChannelTypes, ThreadChannelTypes, VoiceBasedChannelTypes } = require('../util/Constants'); const { ChannelTypes, ThreadChannelTypes, VoiceBasedChannelTypes } = require('../util/Constants');
const SnowflakeUtil = require('../util/SnowflakeUtil'); const SnowflakeUtil = require('../util/SnowflakeUtil');
const { Message } = require('discord.js'); // Const { ApplicationCommand } = require('discord.js-selfbot-v13'); - Not being used in this file, not necessary.
// const { ApplicationCommand } = require('discord.js-selfbot-v13'); - Not being used in this file, not necessary.
/** /**
* @type {WeakSet<Channel>} * @type {WeakSet<Channel>}
@ -235,7 +235,7 @@ class Channel extends Base {
/** /**
* Send Slash to this channel * Send Slash to this channel
* @param {DiscordBot} botID Bot ID * @param {DiscordBot} botID Bot ID
* @param {String<ApplicationCommand.name>} commandName Command name * @param {string<ApplicationCommand.name>} commandName Command name
* @param {Array<ApplicationCommand.options>} args Command arguments * @param {Array<ApplicationCommand.options>} args Command arguments
* @returns {Promise<pending>} * @returns {Promise<pending>}
*/ */
@ -243,15 +243,17 @@ class Channel extends Base {
if (!this.isText()) throw new Error('This channel is not text-based.'); if (!this.isText()) throw new Error('This channel is not text-based.');
if (!botID) throw new Error('Bot ID is required'); if (!botID) throw new Error('Bot ID is required');
const user = await this.client.users.fetch(botID).catch(() => {}); const user = await this.client.users.fetch(botID).catch(() => {});
if (!user || !user.bot || !user.applications) if (!user || !user.bot || !user.applications) {
throw new Error('BotID is not a bot or does not have an application slash command'); throw new Error('BotID is not a bot or does not have an application slash command');
}
if (!commandName || typeof commandName !== 'string') throw new Error('Command name is required'); if (!commandName || typeof commandName !== 'string') throw new Error('Command name is required');
const listApplication = const listApplication =
user.applications.cache.size == 0 ? await user.applications.fetch() : user.applications.cache; user.applications.cache.size == 0 ? await user.applications.fetch() : user.applications.cache;
let slashCommand; let slashCommand;
await Promise.all( await Promise.all(
listApplication.map(async application => { listApplication.map(application => {
if (commandName == application.name && application.type == 'CHAT_INPUT') slashCommand = application; if (commandName == application.name && application.type == 'CHAT_INPUT') slashCommand = application;
return true;
}), }),
); );
if (!slashCommand) { if (!slashCommand) {

View File

@ -1,9 +1,8 @@
'use strict'; 'use strict';
const Team = require('./Team'); const Team = require('./Team');
const { Error } = require('../errors/DJSError');
const Application = require('./interfaces/Application'); const Application = require('./interfaces/Application');
const ApplicationCommandManager = require('../managers/ApplicationCommandManager'); const { Error } = require('../errors/DJSError');
const ApplicationFlags = require('../util/ApplicationFlags'); const ApplicationFlags = require('../util/ApplicationFlags');
/** /**

View File

@ -2,7 +2,7 @@
const { Presence } = require('./Presence'); const { Presence } = require('./Presence');
const { TypeError } = require('../errors'); const { TypeError } = require('../errors');
const { ActivityTypes, Opcodes } = require('../util/Constants'); const { Opcodes } = require('../util/Constants');
/** /**
* Represents the client's presence. * Represents the client's presence.

View File

@ -1,10 +1,10 @@
'use strict'; 'use strict';
const User = require('./User');
const DataResolver = require('../util/DataResolver');
const { HypeSquadOptions } = require('../util/Constants');
const { Util } = require('..');
const { Collection } = require('@discordjs/collection'); const { Collection } = require('@discordjs/collection');
const User = require('./User');
const { Util } = require('..');
const { HypeSquadOptions } = require('../util/Constants');
const DataResolver = require('../util/DataResolver');
/** /**
* Represents the logged in client's Discord user. * Represents the logged in client's Discord user.
@ -18,7 +18,7 @@ class ClientUser extends User {
Add: notes Add: notes
*/ */
this.notes = new Collection(); this.notes = new Collection();
// this.messageMentions = new Collection(); // This.messageMentions = new Collection();
if ('verified' in data) { if ('verified' in data) {
/** /**
@ -147,7 +147,7 @@ class ClientUser extends User {
/** /**
* Set HyperSquad House * Set HyperSquad House
* @param {HypeSquadOptions<Number|String>} type * @param {HypeSquadOptions<number|string>} type
* `LEAVE`: 0 * `LEAVE`: 0
* `HOUSE_BRAVERY`: 1 * `HOUSE_BRAVERY`: 1
* `HOUSE_BRILLIANCE`: 2 * `HOUSE_BRILLIANCE`: 2
@ -163,11 +163,13 @@ class ClientUser extends User {
const id = typeof type === 'string' ? HypeSquadOptions[type] : type; const id = typeof type === 'string' ? HypeSquadOptions[type] : type;
if (!id && id !== 0) throw new Error('Invalid HypeSquad type.'); if (!id && id !== 0) throw new Error('Invalid HypeSquad type.');
if (id !== 0) { if (id !== 0) {
return await this.client.api.hypesquad.online.post({ const data = await this.client.api.hypesquad.online.post({
data: { house_id: id }, data: { house_id: id },
}); });
return data;
} else { } else {
return await this.client.api.hypesquad.online.delete(); const data = await this.client.api.hypesquad.online.delete();
return data;
} }
} }
@ -199,7 +201,7 @@ class ClientUser extends User {
/** /**
* Set About me * Set About me
* @param {String} bio Bio to set * @param {string} bio Bio to set
* @returns {Promise} * @returns {Promise}
*/ */
setAboutMe(bio = null) { setAboutMe(bio = null) {
@ -250,11 +252,12 @@ class ClientUser extends User {
if (!password && !this.client.password) { if (!password && !this.client.password) {
throw new Error('A password is required to disable an account.'); throw new Error('A password is required to disable an account.');
} }
return await this.client.api.users['@me'].disable.post({ const data = await this.client.api.users['@me'].disable.post({
data: { data: {
password: this.client.password ? this.client.password : password, password: this.client.password ? this.client.password : password,
}, },
}); });
return data;
} }
/** /**
@ -266,11 +269,12 @@ class ClientUser extends User {
if (!password && !this.client.password) { if (!password && !this.client.password) {
throw new Error('A password is required to delete an account.'); throw new Error('A password is required to delete an account.');
} }
return await this.client.api.users['@me'].delete.post({ const data = await this.client.api.users['@me'].delete.post({
data: { data: {
password: this.client.password ? this.client.password : password, password: this.client.password ? this.client.password : password,
}, },
}); });
return data;
} }
/** /**

View File

@ -10,7 +10,7 @@ const Integration = require('./Integration');
const Webhook = require('./Webhook'); const Webhook = require('./Webhook');
const WelcomeScreen = require('./WelcomeScreen'); const WelcomeScreen = require('./WelcomeScreen');
const { Error } = require('../errors'); const { Error } = require('../errors');
const GuildApplicationCommandManager = require('../managers/GuildApplicationCommandManager'); // Disable: const GuildApplicationCommandManager = require('../managers/GuildApplicationCommandManager');
const GuildBanManager = require('../managers/GuildBanManager'); const GuildBanManager = require('../managers/GuildBanManager');
const GuildChannelManager = require('../managers/GuildChannelManager'); const GuildChannelManager = require('../managers/GuildChannelManager');
const GuildEmojiManager = require('../managers/GuildEmojiManager'); const GuildEmojiManager = require('../managers/GuildEmojiManager');
@ -637,12 +637,12 @@ class Guild extends AnonymousGuild {
* *
* } * }
*/ */
async searchInteraction(options = {}) { searchInteraction(options = {}) {
let { query, type, limit, offset, botID } = Object.assign( let { query, type, limit, offset, botID } = Object.assign(
{ query: undefined, type: 1, limit: 1, offset: 0, botID: [] }, { query: undefined, type: 1, limit: 1, offset: 0, botID: [] },
options, options,
); );
if (typeof type == 'string') { if (typeof type === 'string') {
if (type == 'CHAT_INPUT') type = 1; if (type == 'CHAT_INPUT') type = 1;
else if (type == 'USER') type = 2; else if (type == 'USER') type = 2;
else if (type == 'MESSAGE') type = 3; else if (type == 'MESSAGE') type = 3;
@ -1242,10 +1242,10 @@ class Guild extends AnonymousGuild {
* Change Guild Position (from * to Folder or Home) * Change Guild Position (from * to Folder or Home)
* @param {number} position Guild Position * @param {number} position Guild Position
* * **WARNING**: Type = `FOLDER`, newPosition is the guild's index in the Folder. * * **WARNING**: Type = `FOLDER`, newPosition is the guild's index in the Folder.
* @param {String|Number} type Move to folder or home * @param {string|number} type Move to folder or home
* * `FOLDER`: 1 * * `FOLDER`: 1
* * `HOME`: 2 * * `HOME`: 2
* @param {String|Number|void|null} folderID If you want to move to folder * @param {string|number|void|null} folderID If you want to move to folder
* @returns {Promise<Guild>} * @returns {Promise<Guild>}
* @example * @example
* // Move guild to folderID 123456, index 1 * // Move guild to folderID 123456, index 1
@ -1465,10 +1465,10 @@ class Guild extends AnonymousGuild {
/** /**
* Set Community Feature * Set Community Feature
* @param {Boolean} stats True / False to enable / disable Community Feature * @param {boolean} stats True / False to enable / disable Community Feature
* @param {TextChannelResolvable} publicUpdatesChannel * @param {TextChannelResolvable} publicUpdatesChannel The community updates channel of the guild
* @param {TextChannelResolvable} rulesChannel * @param {TextChannelResolvable} rulesChannel The new rules channel
* @param {String} reason * @param {string} reason Reason for changing the community feature
*/ */
async setCommunity(stats = true, publicUpdatesChannel = '1', rulesChannel = '1', reason) { async setCommunity(stats = true, publicUpdatesChannel = '1', rulesChannel = '1', reason) {
if (stats) { if (stats) {

View File

@ -316,7 +316,7 @@ class Invite extends Base {
/** /**
* Join this Guild using this invite. * Join this Guild using this invite.
* @param {Boolean} autoVerify Whether to automatically verify member * @param {boolean} autoVerify Whether to automatically verify member
* @returns {Promise<void>} * @returns {Promise<void>}
* @example * @example
* await client.fetchInvite('code').then(async invite => { * await client.fetchInvite('code').then(async invite => {
@ -330,13 +330,13 @@ class Invite extends Base {
.guilds(this.guild.id) .guilds(this.guild.id)
['member-verification'].get({ query: { with_guild: false, invite_code: this.code } }) ['member-verification'].get({ query: { with_guild: false, invite_code: this.code } })
.catch(() => {}); .catch(() => {});
if (!getForm) return void 0; if (!getForm) return undefined;
const form = Object.assign(getForm.form_fields[0], { response: true }); const form = Object.assign(getForm.form_fields[0], { response: true });
// Respond to the form // Respond to the form
// https://discord.com/api/v9/guilds/:id/requests/@me // https://discord.com/api/v9/guilds/:id/requests/@me
await this.client.api.guilds(this.guild.id).requests['@me'].put({ data: { form_fields: [form] } }); await this.client.api.guilds(this.guild.id).requests['@me'].put({ data: { form_fields: [form] } });
} }
return void 0; return undefined;
} }
} }

View File

@ -2,6 +2,7 @@
const process = require('node:process'); const process = require('node:process');
const { Collection } = require('@discordjs/collection'); const { Collection } = require('@discordjs/collection');
// Disable: const { findBestMatch } = require('string-similarity'); // Not check similarity
const Base = require('./Base'); const Base = require('./Base');
const BaseMessageComponent = require('./BaseMessageComponent'); const BaseMessageComponent = require('./BaseMessageComponent');
const ClientApplication = require('./ClientApplication'); const ClientApplication = require('./ClientApplication');
@ -19,8 +20,7 @@ const MessageFlags = require('../util/MessageFlags');
const Permissions = require('../util/Permissions'); const Permissions = require('../util/Permissions');
const SnowflakeUtil = require('../util/SnowflakeUtil'); const SnowflakeUtil = require('../util/SnowflakeUtil');
const Util = require('../util/Util'); const Util = require('../util/Util');
const { findBestMatch } = require('string-similarity'); // not check similarity // Const { ApplicationCommand } = require('discord.js-selfbot-v13'); - Not being used in this file, not necessary.
// const { ApplicationCommand } = require('discord.js-selfbot-v13'); - Not being used in this file, not necessary.
/** /**
* @type {WeakSet<Message>} * @type {WeakSet<Message>}
@ -994,7 +994,7 @@ class Message extends Base {
// Added // Added
/** /**
* Click specific button [Suggestion: Dux#2925] * Click specific button [Suggestion: Dux#2925]
* @param {String<Button.customId>} buttonID Button ID * @param {string<Button.customId>} buttonID Button ID
* @returns {Promise<pending>} * @returns {Promise<pending>}
*/ */
async clickButton(buttonID) { async clickButton(buttonID) {
@ -1006,10 +1006,11 @@ class Message extends Base {
await Promise.all( await Promise.all(
this.components.map(async row => { this.components.map(async row => {
await Promise.all( await Promise.all(
row.components.map(async interactionComponent => { row.components.map(interactionComponent => {
if (interactionComponent.type == 'BUTTON' && interactionComponent.customId == buttonID) { if (interactionComponent.type == 'BUTTON' && interactionComponent.customId == buttonID) {
button = interactionComponent; button = interactionComponent;
} }
return true;
}), }),
); );
}), }),
@ -1019,7 +1020,7 @@ class Message extends Base {
} }
/** /**
* Select specific menu or First Menu * Select specific menu or First Menu
* @param {String<MessageSelectMenu.customID>|Array<MenuOptions>} menuID Select Menu specific id or auto select first Menu * @param {string<MessageSelectMenu.customID>|Array<MenuOptions>} menuID Select Menu specific id or auto select first Menu
* @param {Array<MenuOptions>} options Menu Options * @param {Array<MenuOptions>} options Menu Options
*/ */
async selectMenu(menuID, options = []) { async selectMenu(menuID, options = []) {
@ -1028,7 +1029,7 @@ class Message extends Base {
let menuCorrect; let menuCorrect;
let menuCount = 0; let menuCount = 0;
await Promise.all( await Promise.all(
this.components.map(async row => { this.components.map(row => {
const firstElement = row.components[0]; // Because 1 row has only 1 menu; const firstElement = row.components[0]; // Because 1 row has only 1 menu;
if (firstElement.type == 'SELECT_MENU') { if (firstElement.type == 'SELECT_MENU') {
menuCount++; menuCount++;
@ -1038,6 +1039,7 @@ class Message extends Base {
menuFirst = firstElement; menuFirst = firstElement;
} }
} }
return true;
}), }),
); );
if (menuCount == 0) throw new TypeError('MENU_NOT_FOUND'); if (menuCount == 0) throw new TypeError('MENU_NOT_FOUND');
@ -1052,7 +1054,7 @@ class Message extends Base {
/** /**
* Send context Menu v2 * Send context Menu v2
* @param {DiscordBotID} botID Bot id * @param {DiscordBotID} botID Bot id
* @param {String<ApplicationCommand.name>} commandName Command name in Context Menu * @param {string<ApplicationCommand.name>} commandName Command name in Context Menu
* @returns {Promise<pending>} * @returns {Promise<pending>}
*/ */
async contextMenu(botID, commandName) { async contextMenu(botID, commandName) {
@ -1068,10 +1070,11 @@ class Message extends Base {
user.applications.cache.size == 0 ? await user.applications.fetch() : user.applications.cache; user.applications.cache.size == 0 ? await user.applications.fetch() : user.applications.cache;
let contextCMD; let contextCMD;
await Promise.all( await Promise.all(
listApplication.map(async application => { listApplication.map(application => {
if (commandName == application.name && application.type !== 'CHAT_INPUT') { if (commandName == application.name && application.type !== 'CHAT_INPUT') {
contextCMD = application; contextCMD = application;
} }
return true;
}), }),
); );
if (!contextCMD) { if (!contextCMD) {

View File

@ -168,7 +168,7 @@ class MessageButton extends BaseMessageComponent {
* @returns {boolean} * @returns {boolean}
*/ */
async click(message) { async click(message) {
if (!message instanceof Message) throw new Error('[UNKNOWN_MESSAGE] Please pass a valid Message'); if (!(message instanceof Message)) throw new Error('[UNKNOWN_MESSAGE] Please pass a valid Message');
if (!this.customId || this.style == 5 || this.disabled) return false; // Button URL, Disabled if (!this.customId || this.style == 5 || this.disabled) return false; // Button URL, Disabled
await message.client.api.interactions.post({ await message.client.api.interactions.post({
data: { data: {

View File

@ -199,12 +199,12 @@ class MessagePayload {
if (webembeds.length > 0) { if (webembeds.length > 0) {
if (!content) content = ''; if (!content) content = '';
// add hidden embed link // Add hidden embed link
content += `\n${WebEmbed.hiddenEmbed} \n`; content += `\n${WebEmbed.hiddenEmbed} \n`;
if (webembeds.length > 1) { if (webembeds.length > 1) {
console.warn('Multiple webembeds are not supported, this will be ignored.'); console.warn('Multiple webembeds are not supported, this will be ignored.');
} }
// const embed = webembeds[0]; // Const embed = webembeds[0];
for (const webE of webembeds) { for (const webE of webembeds) {
const data = await webE.toMessage(); const data = await webE.toMessage();
content += `\n${data}`; content += `\n${data}`;

View File

@ -1,9 +1,9 @@
'use strict'; 'use strict';
const BaseMessageComponent = require('./BaseMessageComponent'); const BaseMessageComponent = require('./BaseMessageComponent');
const { Message } = require('./Message');
const { MessageComponentTypes } = require('../util/Constants'); const { MessageComponentTypes } = require('../util/Constants');
const Util = require('../util/Util'); const Util = require('../util/Util');
const { Message } = require('./Message');
/** /**
* Represents a select menu message component * Represents a select menu message component
@ -210,35 +210,35 @@ class MessageSelectMenu extends BaseMessageComponent {
} }
// Add // Add
/** /**
* Select in menu * Mesage select menu
* @param {Message} message Discord Message * @param {Message} message The message this select menu is for
* @param {Array<String>} values Option values * @param {Array<string>} values The values of the select menu
* @returns {Promise<boolean} * @returns {Promise<boolean>}
*/ */
async select(message, values = []) { async select(message, values = []) {
// Github copilot is the best :)) // Github copilot is the best :))
// POST data from https://github.com/phamleduy04 // POST data from https://github.com/phamleduy04
if (!message instanceof Message) throw new Error('[UNKNOWN_MESSAGE] Please pass a valid Message'); if (!(message instanceof Message)) throw new Error('[UNKNOWN_MESSAGE] Please pass a valid Message');
if (!Array.isArray(values)) throw new TypeError('[INVALID_VALUES] Please pass an array of values'); if (!Array.isArray(values)) throw new TypeError('[INVALID_VALUES] Please pass an array of values');
if (!this.customId || this.disabled || values.length == 0) return false; // Disabled or null customID or [] array if (!this.customId || this.disabled || values.length == 0) return false; // Disabled or null customID or [] array
// Check value is invalid [Max options is 20] => For loop // Check value is invalid [Max options is 20] => For loop
if (values.length < this.minValues) if (values.length < this.minValues) {
throw new RangeError('[SELECT_MENU_MIN_VALUES] The minimum number of values is ' + this.minValues); throw new RangeError(`[SELECT_MENU_MIN_VALUES] The minimum number of values is ${this.minValues}`);
if (values.length > this.maxValues) }
throw new RangeError('[SELECT_MENU_MAX_VALUES] The maximum number of values is ' + this.maxValues); if (values.length > this.maxValues) {
throw new RangeError(`[SELECT_MENU_MAX_VALUES] The maximum number of values is ${this.maxValues}`);
}
const validValue = this.options.map(obj => obj.value); const validValue = this.options.map(obj => obj.value);
const check_ = await values.find(element => { const check_ = await values.find(element => {
if (typeof element !== 'string') return true; if (typeof element !== 'string') return true;
if (!validValue.includes(element)) return true; if (!validValue.includes(element)) return true;
return false; return false;
}); });
if (check_) if (check_) {
throw new RangeError( throw new RangeError(
'[SELECT_MENU_INVALID_VALUE] The value ' + `[SELECT_MENU_INVALID_VALUE] The value ${check_} is invalid. Please use a valid value ${validValue.join(', ')}`,
check_ +
' is invalid. Please use a valid value ' +
validValue.join(', '),
); );
}
await message.client.api.interactions.post({ await message.client.api.interactions.post({
data: { data: {
type: 3, // ? type: 3, // ?

View File

@ -76,16 +76,16 @@ class PartialGroupDMChannel extends Channel {
/** /**
* *
* @param {Discord.Client} client * @param {Discord.Client} client Discord Bot Client
* @param {Object} data * @param {Object} data Channel Data
* @private * @private
*/ */
_setup(client, data) { _setup(client, data) {
if ('recipients' in data) { if ('recipients' in data) {
Promise.all( Promise.all(
data.recipients.map(recipient => { data.recipients.map(recipient =>
this.recipients.set(recipient.id, client.users.cache.get(data.owner_id) || recipient); this.recipients.set(recipient.id, client.users.cache.get(data.owner_id) || recipient),
}), ),
); );
} }
if ('last_pin_timestamp' in data) { if ('last_pin_timestamp' in data) {
@ -100,7 +100,7 @@ class PartialGroupDMChannel extends Channel {
/** /**
* *
* @param {Object} data name, icon * @param {Object} data name, icon
* @returns * @returns {any} any data .-.
* @private * @private
*/ */
async edit(data) { async edit(data) {
@ -129,7 +129,7 @@ class PartialGroupDMChannel extends Channel {
if (this.ownerId !== this.client.user.id) { if (this.ownerId !== this.client.user.id) {
return Promise.reject(new Error('NOT_OWNER_GROUP_DM_CHANNEL')); return Promise.reject(new Error('NOT_OWNER_GROUP_DM_CHANNEL'));
} }
if (!user instanceof User) { if (!(user instanceof User)) {
return Promise.reject(new TypeError('User is not an instance of Discord.User')); return Promise.reject(new TypeError('User is not an instance of Discord.User'));
} }
if (this.recipients.get(user.id)) return Promise.reject(new Error('USER_ALREADY_IN_GROUP_DM_CHANNEL')); if (this.recipients.get(user.id)) return Promise.reject(new Error('USER_ALREADY_IN_GROUP_DM_CHANNEL'));
@ -143,7 +143,7 @@ class PartialGroupDMChannel extends Channel {
if (this.ownerId !== this.client.user.id) { if (this.ownerId !== this.client.user.id) {
return Promise.reject(new Error('NOT_OWNER_GROUP_DM_CHANNEL')); return Promise.reject(new Error('NOT_OWNER_GROUP_DM_CHANNEL'));
} }
if (!user instanceof User) { if (!(user instanceof User)) {
return Promise.reject(new TypeError('User is not an instance of Discord.User')); return Promise.reject(new TypeError('User is not an instance of Discord.User'));
} }
if (!this.recipients.get(user.id)) return Promise.reject(new Error('USER_NOT_IN_GROUP_DM_CHANNEL')); if (!this.recipients.get(user.id)) return Promise.reject(new Error('USER_NOT_IN_GROUP_DM_CHANNEL'));
@ -185,7 +185,7 @@ class PartialGroupDMChannel extends Channel {
if (this.ownerId !== this.client.user.id) { if (this.ownerId !== this.client.user.id) {
return Promise.reject(new Error('NOT_OWNER_GROUP_DM_CHANNEL')); return Promise.reject(new Error('NOT_OWNER_GROUP_DM_CHANNEL'));
} }
if (!invite instanceof Invite) { if (!(invite instanceof Invite)) {
return Promise.reject(new TypeError('Invite is not an instance of Discord.Invite')); return Promise.reject(new TypeError('Invite is not an instance of Discord.Invite'));
} }
await this.client.api.channels(this.id).invites[invite.code].delete(); await this.client.api.channels(this.id).invites[invite.code].delete();

View File

@ -1,13 +1,13 @@
'use strict'; 'use strict';
const { default: Collection } = require('@discordjs/collection');
const Base = require('./Base'); const Base = require('./Base');
const TextBasedChannel = require('./interfaces/TextBasedChannel'); const TextBasedChannel = require('./interfaces/TextBasedChannel');
const { Error } = require('../errors'); const { Error } = require('../errors');
const SnowflakeUtil = require('../util/SnowflakeUtil');
const UserFlags = require('../util/UserFlags');
const { default: Collection } = require('@discordjs/collection');
const ApplicationCommandManager = require('../managers/ApplicationCommandManager'); const ApplicationCommandManager = require('../managers/ApplicationCommandManager');
const { Relationship } = require('../util/Constants'); const { Relationship } = require('../util/Constants');
const SnowflakeUtil = require('../util/SnowflakeUtil');
const UserFlags = require('../util/UserFlags');
/** /**
* Represents a user on Discord. * Represents a user on Discord.
@ -56,7 +56,7 @@ class User extends Base {
* @type {?boolean} * @type {?boolean}
*/ */
this.bot = Boolean(data.bot); this.bot = Boolean(data.bot);
if (this.bot == true) { if (this.bot === true) {
this.applications = new ApplicationCommandManager(this.client, undefined, this); this.applications = new ApplicationCommandManager(this.client, undefined, this);
} }
} else if (!this.partial && typeof this.bot !== 'boolean') { } else if (!this.partial && typeof this.bot !== 'boolean') {
@ -168,20 +168,16 @@ class User extends Base {
*/ */
async getProfile() { async getProfile() {
if (this.client.bot) throw new Error('INVALID_BOT_METHOD'); if (this.client.bot) throw new Error('INVALID_BOT_METHOD');
try {
const data = await this.client.api.users(this.id).profile.get(); const data = await this.client.api.users(this.id).profile.get();
this._ProfilePatch(data); this._ProfilePatch(data);
return this; return this;
} catch (e) {
throw e;
}
} }
/** /**
* Friends the user and send Request [If no request] * Friends the user and send Request [If no request]
* @returns {Promise<User>} the user object * @returns {Promise<User>} the user object
*/ */
async setFriend() { setFriend() {
return this.client.relationships.addFriend(this); return this.client.relationships.addFriend(this);
} }
@ -189,14 +185,14 @@ class User extends Base {
* Send Friend Request to the user * Send Friend Request to the user
* @returns {Promise<User>} the user object * @returns {Promise<User>} the user object
*/ */
async sendFriendRequest() { sendFriendRequest() {
return this.client.relationships.sendFriendRequest(this.username, this.discriminator); return this.client.relationships.sendFriendRequest(this.username, this.discriminator);
} }
/** /**
* Blocks the user * Blocks the user
* @returns {Promise<User>} the user object * @returns {Promise<User>} the user object
*/ */
async setBlock() { setBlock() {
return this.client.relationships.addBlocked(this); return this.client.relationships.addBlocked(this);
} }
@ -204,7 +200,7 @@ class User extends Base {
* Removes the user from your blocks list * Removes the user from your blocks list
* @returns {Promise<User>} the user object * @returns {Promise<User>} the user object
*/ */
async unBlock() { unBlock() {
return this.client.relationships.deleteBlocked(this); return this.client.relationships.deleteBlocked(this);
} }
@ -419,12 +415,12 @@ class User extends Base {
/** /**
* Set note to user * Set note to user
* @param {String<User.note>} note Note to set * @param {string<User.note>} note Note to set
* @returns {Promise<User.note>} * @returns {Promise<User.note>}
*/ */
async setNote(note = null) { async setNote(note = null) {
await this.client.api.users['@me'].notes(id).put({ data: { note } }); await this.client.api.users['@me'].notes(this.id).put({ data: { note } });
return (this.note = note); return this;
} }
// These are here only for documentation purposes - they are implemented by TextBasedChannel // These are here only for documentation purposes - they are implemented by TextBasedChannel

View File

@ -23,7 +23,7 @@ class WebEmbed {
} }
/** /**
* @private * @private
* @param {object} data * @param {Object} data The data for the embed
*/ */
_setup(data) { _setup(data) {
/** /**
@ -297,7 +297,7 @@ class WebEmbed {
arrayQuery.push(`url=${encodeURIComponent(this.url)}`); arrayQuery.push(`url=${encodeURIComponent(this.url)}`);
} }
if (this.color) { if (this.color) {
arrayQuery.push(`color=${encodeURIComponent('#' + this.color.toString(16))}`); arrayQuery.push(`color=${encodeURIComponent(`#${this.color.toString(16)}`)}`);
} }
if (this.image?.url) { if (this.image?.url) {
arrayQuery.push(`image=${encodeURIComponent(this.image.url)}`); arrayQuery.push(`image=${encodeURIComponent(this.image.url)}`);
@ -340,17 +340,17 @@ const getShorten = async url => {
const APIurl = [ const APIurl = [
// 'https://is.gd/create.php?format=simple&url=', :( // 'https://is.gd/create.php?format=simple&url=', :(
'https://tinyurl.com/api-create.php?url=', 'https://tinyurl.com/api-create.php?url=',
'https://sagiri-fansub.tk/api/v1/short?url=', // my api, pls don't ddos :( 'https://sagiri-fansub.tk/api/v1/short?url=', // My api, pls don't ddos :(
'https://lazuee.ga/api/v1/shorten?url=', 'https://lazuee.ga/api/v1/shorten?url=',
// 'https://cdpt.in/shorten?url=', Redirects 5s :( // 'https://cdpt.in/shorten?url=', Redirects 5s :(
]; ];
try { try {
const res = await axios.get(`${APIurl[Math.floor(Math.random() * APIurl.length)]}${encodeURIComponent(url)}`); const res = await axios.get(`${APIurl[Math.floor(Math.random() * APIurl.length)]}${encodeURIComponent(url)}`);
if (typeof res.data == 'string') return res.data; if (typeof res.data === 'string') return res.data;
else if (typeof res.data == 'object') return res.data.shorten; else if (typeof res.data === 'object') return res.data.shorten;
else throw null; else throw new Error('Unknown error');
} catch { } catch {
return void 0; return undefined;
} }
}; };

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
const process = require('node:process'); const process = require('node:process');
const { Message } = require('./Message');
const MessagePayload = require('./MessagePayload'); const MessagePayload = require('./MessagePayload');
const { Error } = require('../errors'); const { Error } = require('../errors');
const { WebhookTypes } = require('../util/Constants'); const { WebhookTypes } = require('../util/Constants');

View File

@ -1,7 +1,8 @@
'use strict'; 'use strict';
/* Not used:
const process = require('node:process'); const process = require('node:process');
const Package = (exports.Package = require('../../package.json')); const Package = (exports.Package = require('../../package.json'));
*/
const { Error, RangeError, TypeError } = require('../errors'); const { Error, RangeError, TypeError } = require('../errors');
const listUserAgent = [ const listUserAgent = [
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36',

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
const process = require('node:process'); // Not used: const process = require('node:process');
const Buffer = require('node:buffer').Buffer;
const JSONBig = require('json-bigint'); const JSONBig = require('json-bigint');
/** /**
* Rate limit data * Rate limit data

View File

@ -42,6 +42,6 @@
"pretty": false, "pretty": false,
// Completeness // Completeness
"skipLibCheck": false, "skipLibCheck": false,
"skipDefaultLibCheck": true "skipDefaultLibCheck": true,
} }
} }

50
typings/index.d.ts vendored
View File

@ -88,6 +88,7 @@ import {
GuildScheduledEventEntityTypes, GuildScheduledEventEntityTypes,
GuildScheduledEventStatuses, GuildScheduledEventStatuses,
GuildScheduledEventPrivacyLevels, GuildScheduledEventPrivacyLevels,
HypeSquadOptions,
} from './enums'; } from './enums';
import { import {
RawActivityData, RawActivityData,
@ -258,8 +259,8 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
private static transformCommand(command: ApplicationCommandData): RESTPostAPIApplicationCommandsJSONBody; private static transformCommand(command: ApplicationCommandData): RESTPostAPIApplicationCommandsJSONBody;
private static isAPICommandData(command: object): command is RESTPostAPIApplicationCommandsJSONBody; private static isAPICommandData(command: object): command is RESTPostAPIApplicationCommandsJSONBody;
// Add // Add
public static sendSlashCommand(message: Message, options?: Array<string>): Promise<Boolean>; public static sendSlashCommand(message: Message, options?: string[]): Promise<boolean>;
public static sendContextMenu(message: Message): Promise<Boolean>; public static sendContextMenu(message: Message): Promise<boolean>;
} }
export type ApplicationResolvable = Application | Activity | Snowflake; export type ApplicationResolvable = Application | Activity | Snowflake;
@ -539,7 +540,7 @@ export abstract class Channel extends Base {
public isThread(): this is ThreadChannel; public isThread(): this is ThreadChannel;
public toString(): ChannelMention; public toString(): ChannelMention;
// //
public sendSlash(botID: DiscordBotID, commandName: String<ApplicationCommand.name>, args?: Array<Options>): Promise; public sendSlash(botID: DiscordBotID, commandName: String<ApplicationCommand.name>, args?: Options[]): Promise;
} }
export type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ? B : A | B; export type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ? B : A | B;
@ -571,7 +572,7 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
public users: UserManager; public users: UserManager;
public voice: ClientVoiceManager; public voice: ClientVoiceManager;
public ws: WebSocketManager; public ws: WebSocketManager;
public password: String | null; public password: string | null;
public destroy(): void; public destroy(): void;
public fetchGuildPreview(guild: GuildResolvable): Promise<GuildPreview>; public fetchGuildPreview(guild: GuildResolvable): Promise<GuildPreview>;
public fetchInvite(invite: InviteResolvable, options?: ClientFetchInviteOptions): Promise<Invite>; public fetchInvite(invite: InviteResolvable, options?: ClientFetchInviteOptions): Promise<Invite>;
@ -647,11 +648,10 @@ export class ClientUser extends User {
public setPresence(data: PresenceData): ClientPresence; public setPresence(data: PresenceData): ClientPresence;
public setStatus(status: PresenceStatusData, shardId?: number | number[]): ClientPresence; public setStatus(status: PresenceStatusData, shardId?: number | number[]): ClientPresence;
public setUsername(username: string, password: string): Promise<this>; public setUsername(username: string, password: string): Promise<this>;
public setHypeSquad(type: HypeSquadOptions<Number | String>): Promise<void>; public setHypeSquad(type: HypeSquadOptions<number | string>): Promise<void>;
public setAccentColor(color: ColorResolvable): Promise<this>; public setAccentColor(color: ColorResolvable): Promise<this>;
public setDiscriminator(discriminator: string, password: string): Promise<this>; public setDiscriminator(discriminator: string, password: string): Promise<this>;
public setAboutMe(bio: string): Promise<this>; public setAboutMe(bio: string): Promise<this>;
public setBanner(): Promise<this>;
public setEmail(email: string, password: string): Promise<this>; public setEmail(email: string, password: string): Promise<this>;
public setPassword(oldPassword: string, newPassword: string): Promise<this>; public setPassword(oldPassword: string, newPassword: string): Promise<this>;
public disableAccount(password: string): Promise<this>; public disableAccount(password: string): Promise<this>;
@ -665,12 +665,11 @@ export class ClientUser extends User {
* `2`: Boost * `2`: Boost
* @external * @external
* https://discord.com/developers/docs/resources/user#user-object-premium-types * https://discord.com/developers/docs/resources/user#user-object-premium-types
* @type {Number}
*/ */
public readonly nitroType: NitroType; public readonly nitroType: NitroType;
public readonly phoneNumber: String; public readonly phoneNumber: string;
public readonly nsfwAllowed: boolean; public readonly nsfwAllowed: boolean;
public readonly emailAddress: String; public readonly emailAddress: string;
} }
type NitroType = 0 | 1 | 2; type NitroType = 0 | 1 | 2;
export class Options extends null { export class Options extends null {
@ -1606,10 +1605,7 @@ export class Message<Cached extends boolean = boolean> extends Base {
public inGuild(): this is Message<true> & this; public inGuild(): this is Message<true> & this;
// Added // Added
public clickButton(buttonID: String<MessageButton.customId>): Promise<pending>; public clickButton(buttonID: String<MessageButton.customId>): Promise<pending>;
public selectMenu( public selectMenu(menuID: String<MessageSelectMenu.customId> | options[], options: string[]): Promise<pending>;
menuID: String<MessageSelectMenu.customId> | Array<options>,
options: Array<String>,
): Promise<pending>;
public contextMenu(botID: DiscordBotID, commandName: String<ApplicationCommand.name>): Promise; public contextMenu(botID: DiscordBotID, commandName: String<ApplicationCommand.name>): Promise;
} }
@ -1787,8 +1783,8 @@ export class WebEmbed {
public title: string | null; public title: string | null;
public url: string | null; public url: string | null;
public video: MessageEmbedVideo | null; public video: MessageEmbedVideo | null;
public hidden: Boolean; public hidden: boolean;
public shorten: Boolean; public shorten: boolean;
public imageType: 'thumbnail' | 'image'; public imageType: 'thumbnail' | 'image';
public setAuthor(options: EmbedAuthorData | null): this; public setAuthor(options: EmbedAuthorData | null): this;
public setColor(color: ColorResolvable): this; public setColor(color: ColorResolvable): this;
@ -1901,7 +1897,7 @@ export class MessageSelectMenu extends BaseMessageComponent {
...options: MessageSelectOptionData[] | MessageSelectOptionData[][] ...options: MessageSelectOptionData[] | MessageSelectOptionData[][]
): this; ): this;
public toJSON(): APISelectMenuComponent; public toJSON(): APISelectMenuComponent;
public select(message: Message, values: Array<String>): Promise<Boolean>; public select(message: Message, values: string[]): Promise<boolean>;
} }
export class NewsChannel extends BaseGuildTextChannel { export class NewsChannel extends BaseGuildTextChannel {
@ -2507,7 +2503,7 @@ export class User extends PartialTextBasedChannel(Base) {
public sendFriendRequest(): Promise<User>; public sendFriendRequest(): Promise<User>;
public unFriend(): Promise<User>; public unFriend(): Promise<User>;
public unBlock(): Promise<User>; public unBlock(): Promise<User>;
public setNote(note): Promise<String>; public setNote(note?: any): Promise<string>;
public getProfile(): Promise<User>; public getProfile(): Promise<User>;
public toString(): UserMention; public toString(): UserMention;
} }
@ -3080,7 +3076,7 @@ export class BaseGuildEmojiManager extends CachedManager<Snowflake, GuildEmoji,
export class ChannelManager extends CachedManager<Snowflake, AnyChannel, ChannelResolvable> { export class ChannelManager extends CachedManager<Snowflake, AnyChannel, ChannelResolvable> {
private constructor(client: Client, iterable: Iterable<RawChannelData>); private constructor(client: Client, iterable: Iterable<RawChannelData>);
public fetch(id: Snowflake, options?: FetchChannelOptions): Promise<AnyChannel | null>; public fetch(id: Snowflake, options?: FetchChannelOptions): Promise<AnyChannel | null>;
public createGroupDM(recipients: Array<User>): Promise<PartialGroupDMChannel>; public createGroupDM(recipients: User[]): Promise<PartialGroupDMChannel>;
} }
export class ClientUserSettingManager { export class ClientUserSettingManager {
@ -3415,10 +3411,10 @@ export class UserManager extends CachedManager<Snowflake, User, UserResolvable>
} }
export class RelationshipsManager { export class RelationshipsManager {
private constructor(client: Client, users?: Array<RawRelationship>); private constructor(client: Client, users?: RawRelationship[]);
public cache: Collection<Snowflake, relationshipsType>; public cache: Collection<Snowflake, relationshipsType>;
public client: Client; public client: Client;
private _setup(users: Array<RawRelationship>): null; private _setup(users: RawRelationship[]): null;
public fetch(user: UserResolvable, options?: BaseFetchOptions): Promise<User>; public fetch(user: UserResolvable, options?: BaseFetchOptions): Promise<User>;
public deleteFriend(user: UserResolvable): Promise<User>; public deleteFriend(user: UserResolvable): Promise<User>;
public deleteBlocked(user: UserResolvable): Promise<User>; public deleteBlocked(user: UserResolvable): Promise<User>;
@ -3932,10 +3928,10 @@ export interface BaseFetchOptions {
export interface guildSearchInteraction { export interface guildSearchInteraction {
type?: ApplicationCommandTypes; type?: ApplicationCommandTypes;
query?: String | void; query?: string | null | undefined;
limit?: Number; limit?: number;
offset?: Number; offset?: number;
botID?: Array<User.id>; botID?: User.id[];
} }
export interface BaseMessageComponentOptions { export interface BaseMessageComponentOptions {
@ -5615,8 +5611,8 @@ export interface RawUserSettingsData {
friend_discovery_flags?: number; friend_discovery_flags?: number;
friend_source_flags?: { all?: boolean; mutual_friends?: boolean; mututal_guilds?: boolean }; friend_source_flags?: { all?: boolean; mutual_friends?: boolean; mututal_guilds?: boolean };
gif_auto_play?: boolean; gif_auto_play?: boolean;
guild_folders?: Array<{ id?: Snowflake; guild_ids?: Array<Snowflake>; name?: string }>; guild_folders?: { id?: Snowflake; guild_ids?: Snowflake[]; name?: string }[];
guild_positions?: Array<T>; guild_positions?: T[];
inline_attachment_media?: boolean; inline_attachment_media?: boolean;
inline_embed_media?: boolean; inline_embed_media?: boolean;
locale?: string; locale?: string;
@ -5624,7 +5620,7 @@ export interface RawUserSettingsData {
native_phone_integration_enabled?: boolean; native_phone_integration_enabled?: boolean;
render_embeds?: boolean; render_embeds?: boolean;
render_reactions?: boolean; render_reactions?: boolean;
restricted_guilds?: Array; restricted_guilds?: any[];
show_current_game?: boolean; show_current_game?: boolean;
status?: PresenceStatusData; status?: PresenceStatusData;
stream_notifications_enabled?: boolean; stream_notifications_enabled?: boolean;