Merge branch 'aiko-chan-ai:main' into main

This commit is contained in:
TheDevYellowy 2022-08-01 07:56:23 -07:00 committed by GitHub
commit 7129d63d81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 1159 additions and 1433 deletions

19
docs/logo.svg Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="100%" width="100%" viewBox="0 0 6111.4378 1102.9827">
<g transform="translate(2539.6 -107.66)">
<g id="logo-discord" fill="#3d3f42" transform="translate(-44.194 1175.6)">
<path d="m-2495.4-1051.4v453.6 453.6l145.75-.37695c127.36-.3288 147.71-.58582 161.25-2.041 45.045-4.8398 76.353-11.233 111.79-22.826 44.217-14.465 83.672-35.567 118.71-63.49 13.615-10.851 40.444-37.567 50.889-50.674 37.186-46.665 61.816-98.191 78.01-163.2 23.57-94.614 23.154-219.66-1.0469-313.5-41.72-161.77-155.27-260-329.35-284.92-38.756-5.5479-34.464-5.4161-190.75-5.8086l-145.25-.3652zm161 130.09 41.75.0156c55.334.0205 78.397 1.6295 108.25 7.5566 105.75 20.995 171.57 87.554 196.39 198.59 12.878 57.6 14.716 139.6 4.5469 202.81-7.3952 45.963-21.469 87.286-40.711 119.53-12.041 20.179-33.82 45.681-51 59.719-38.627 31.563-87.98 50.255-148.73 56.326-9.5463.9541-32.361 1.7291-62.75 2.1328l-47.75.63477v-323.66-323.66z"/>
<path d="m-1631.4-597.85v-453.5h80.5 80.5v453.5 453.5h-80.5-80.5v-453.5z"/>
<path d="m-1008.4-128.41c-96.325-5.9603-189.36-41.918-264.54-102.25-15.565-12.49-33-28.526-33-30.352 0-.7224 20.622-25.63 45.826-55.351l45.826-54.038 3.8214 3.2697c17.83 15.256 22.538 19.151 29.616 24.501 48.673 36.79 103.35 61.169 158.92 70.862 18.387 3.2073 54.666 4.419 74.088 2.4745 41.751-4.1802 74.798-17.199 96.864-38.16 10.213-9.7012 15.896-17.429 21.626-29.408 17.4-36.376 13.152-81.77-10.39-111-16.357-20.31-45.054-37.907-98.696-60.521-41.654-17.56-164.15-71.537-176.19-77.638-85.541-43.335-134.63-104.27-148.9-184.84-2.6851-15.162-3.7276-49.931-1.9989-66.666 7.4631-72.25 48.261-136.63 113.09-178.46 41.81-26.976 88.546-43.103 144.99-50.03 20.52-2.5182 67.722-2.5268 88-.016 74.352 9.2063 141.74 36.296 199 79.999 18.772 14.327 37.632 31.435 36.864 33.44-.2001.52235-18.812 23.693-41.361 51.49l-40.997 50.54-3.503-2.9264c-1.9267-1.6095-9.4625-7.4505-16.746-12.98-44.158-33.522-88.429-52.307-140.26-59.513-17.665-2.4562-54.274-2.4782-70-.042-35.82 5.5488-61.303 16.869-80.113 35.588-17.506 17.422-26.238 37.587-27.528 63.576-1.3118 26.419 6.521 48.306 24.066 67.249 17.834 19.254 45.314 35.115 99.448 57.398 32.211 13.259 137.3 57.517 151.65 63.864 47.003 20.795 80.577 42.726 108.49 70.87 43.959 44.316 64.938 98.562 65.021 168.13.053 44.646-7.8058 78.816-26.734 116.23-12.46 24.632-27.741 45.114-49.45 66.28-51.458 50.172-122.59 79.937-208.86 87.392-17.502 1.5126-51.786 2.0335-67.962 1.0326z"/>
<path d="m-155.84-128.44c-100.7-5.7557-190.26-44.562-257.1-111.4-58.171-58.171-98.098-136.72-116.41-229.01-13.522-68.153-15.549-148.4-5.5195-218.5 13.11-91.624 47.506-173.73 99.29-237 11.342-13.858 35.64-38.591 49.282-50.164 54.726-46.425 120.9-76.546 193.88-88.256 25.873-4.1511 37.999-5.0552 67.977-5.0681 28.858-.013 38.31.6981 60.5 4.5485 70.566 12.245 140.29 49.396 192.89 102.78l6.8911 6.9936-2.8911 3.4607c-1.59 1.9034-21.52 24.408-44.288 50.011l-41.397 46.551-10.103-9.0797c-40.998-36.846-79.308-56.146-125.89-63.421-13.826-2.1591-48.594-2.4422-62.711-.51067-51.945 7.1074-94.856 27.696-131.17 62.933-64.806 62.887-97.854 165.12-92.829 287.16 2.697 65.505 14.091 119.1 35.16 165.38 30.027 65.96 77.365 110.94 138.03 131.16 24.572 8.1885 46.583 11.525 76.026 11.525 45.839 0 83.431-9.665 120.81-31.062 19.559-11.195 45.837-32.314 63.267-50.848 3.7379-3.9745 7.1554-7.0833 7.5942-6.9085 1.3142.5236 88.109 97.158 88.109 98.098 0 2.0843-41.684 42.322-54 52.126-73.043 58.146-157.48 84.1-255.41 78.503z"/>
<path d="m610.07-1067.8c-34.898-.056-47.464.862-75.232 5.4922-188.34 31.405-308.9 182.45-325.21 407.46-2.8044 38.675-2.2536 84.125 1.4941 123.38 9.2582 96.975 39.751 184.31 87.494 250.58 57.015 79.142 139.29 130.29 236.46 147 14.533 2.4988 40.496 5.3373 53.5 5.8496 147.12 5.7956 267.7-55.193 342.98-173.48 10.897-17.122 28.991-52.974 36.758-72.828 27.4-70.046 39.498-139.21 39.617-226.5.062-45.479-1.9339-73.343-7.9121-110.4-31.164-193.18-145.75-321-314.25-350.53-27.838-4.8789-41.445-5.9606-75.699-6.0156zm-1.4395 139.59c2.8062.0114 5.6199.0752 8.4395.19336 49.33 2.0671 91.449 18.361 127.46 49.305 12.954 11.133 20.363 19.102 31.482 33.861 40.99 54.409 62.709 125.93 66.582 219.25 4.5628 109.93-19.826 208.09-67.676 272.39-33.936 45.599-76.643 72.514-130.84 82.459-10.577 1.9408-50.92 2.8029-62 1.3242-74.694-9.9681-131.62-54.014-168.58-130.43-24.356-50.365-36.989-106.85-39.92-178.5-5.9652-145.81 37.791-262.31 118.61-315.79 33.933-22.452 74.357-34.245 116.45-34.074z"/>
<path d="m1187.6-1051.4v453.54 453.54h80.5 80.5v-177.51-177.51l68.717.25585 68.719.25782 97.531 177.22 97.533 177.22 90.285.0273c85.686.0268 90.237-.0599 89.336-1.7207-.5222-.9625-49.147-86.08-108.05-189.15-58.906-103.07-106.98-187.52-106.83-187.67.1497-.14971 5.5455-2.31 11.99-4.8008 92.947-35.923 149.28-103.8 164.7-198.43 3.4973-21.47 4.3763-36.845 3.7539-65.688-.8444-39.124-4.5518-62.293-14.883-93.008-29.696-88.286-106.44-143.03-224.91-160.44-38.597-5.6719-28.81-5.4157-221.14-5.7871l-177.75-.3438zm161 128.95 84.25.37695c91.298.40795 95.375.61732 123.75 6.3809 23.495 4.7723 45.38 13.215 61 23.533 15.167 10.019 29.716 27.182 37.475 44.207 14.573 31.978 16.395 82.735 4.3301 120.62-6.6274 20.814-16.172 36.615-31.18 51.625-27.567 27.57-66.814 42.804-121.93 47.324-7.3903.60617-43.437 1.0508-85.25 1.0508h-72.445v-147.56-147.56z"/>
<path d="m2014.6-1051.4v453.6 453.6l145.75-.37695c156.69-.4046 153.13-.29648 191.25-5.8008 38.321-5.5332 77.017-15.82 109.08-28.998 17.362-7.137 22.208-9.743 21.508-11.566-.3206-.8355-1.452-4.9721-2.5156-9.1914-3.4865-13.831-4.3718-23.482-3.7617-41.053.63-18.145 2.2913-27.3 7.7285-42.617 17.594-49.562 60.836-85.599 112.95-94.131 16.457-2.6941 38.955-1.8474 57.701 2.1719 3.6928.79178 3.1565 1.7476 11.26-20.041 27.066-72.775 38.169-169.68 30.476-265.97-14.239-178.25-95.276-299.81-236.97-355.47-33.122-13.01-69.539-22.404-108.45-27.975-38.756-5.5479-34.464-5.4161-190.75-5.8086l-145.25-.3652zm161 130.09 41.75.0156c55.334.0205 78.397 1.6295 108.25 7.5566 105.75 20.995 171.57 87.554 196.39 198.59 12.878 57.6 14.716 139.6 4.5469 202.81-7.3952 45.963-21.469 87.286-40.711 119.53-12.041 20.179-33.82 45.681-51 59.719-38.627 31.563-87.98 50.255-148.73 56.326-9.5463.9541-32.361 1.7291-62.75 2.1328l-47.75.63477v-323.66-323.66z"/>
</g>
<circle id="logo-dot" cx="2575.3" cy="939.96" r="125.4" fill="#499a6c"/>
<g id="logo-js" fill="#33b5e5" transform="translate(-44.194 1175.6)">
<path d="m2602.1 34.57c-57.094-4.6075-113.49-28.558-158.26-67.213-27.741-23.949-51.228-55.235-63.883-85.094-5.4804-12.93-5.926-15.992-2.3882-16.406 8.1404-.953 38.073-7.05 53.318-10.86 20.337-5.0831 29.827-8.2686 48.112-16.15 12.138-5.2318 12.996-5.46 14-3.7198 14.778 25.613 36.757 46.236 62.906 59.024 21.609 10.567 39.696 14.761 63.664 14.761 23.073 0 41.694-4.1466 61.73-13.746 36.584-17.528 62.542-46.884 75.844-85.772 2.3995-7.0151 7.5664-31.714 9.361-44.747 2.8753-20.881 3.0454-40.134 3.0555-345.75l.01-314.25h78 78v318.25c0 209.58-.3574 323.03-1.0389 332.25-4.4405 60.076-22.061 115.17-51.016 159.5-11.306 17.311-21.135 29.375-35.857 44.012-44.122 43.866-101.51 69.204-169.58 74.876-17.815 1.4842-53.463 2.0433-65.964 1.0344z"/>
<path d="m3256.6 33.535c-103.92-8.2588-202.14-50.771-278.59-120.57l-11.459-10.464 4.7737-5.6963c2.6255-3.133 23.371-27.615 46.101-54.405l41.327-48.709 11.068 9.6086c54.856 47.624 120.13 79.074 185.78 89.508 19.275 3.0634 60.816 3.3389 79 .5237 56.007-8.6707 91.978-30.946 109.48-67.793 5.7814-12.174 8.6772-25.17 9.2639-41.574 1.8511-51.755-20.009-81.836-81.241-111.79-10.45-5.1123-25.75-12.128-34-15.591-32.568-13.67-168.23-73.282-178.56-78.459-84.895-42.577-136.19-105.76-149.34-183.97-24.654-146.62 80.068-271.29 246.91-293.93 39.105-5.3065 82.999-4.2183 122.48 3.0365 76.174 13.996 145.21 48.561 201.87 101.07l7.367 6.8275-39.699 49c-21.834 26.95-40.537 49.863-41.563 50.918-1.8327 1.8856-1.9536 1.8424-7.1685-2.562-25.013-21.126-59.394-41.952-87.804-53.188-33.742-13.345-63.677-18.968-101.5-19.066-28.062-.0727-45.321 2.2-65.5 8.6248-40.117 12.773-65.445 37.309-74.612 72.282-3.4331 13.097-3.8978 33.664-1.0368 45.883 7.6067 32.488 29.949 55.7 75.674 78.622 15.123 7.5809 24.021 11.522 52.974 23.46 125.45 51.728 173.58 73.274 198.67 88.935 70.314 43.888 106.41 97.76 116.97 174.59 2.1563 15.683 2.4444 55.002.5056 69-7.9359 57.297-31.186 104.9-70.626 144.6-53.439 53.792-126.37 84.242-218.91 91.402-14.98 1.1588-53.385 1.0944-68.605-.1152z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.2 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "discord.js-selfbot-v13", "name": "discord.js-selfbot-v13",
"version": "2.4.6", "version": "2.4.7",
"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",
@ -52,7 +52,7 @@
"homepage": "https://github.com/aiko-chan-ai/discord.js-selfbot-v13#readme", "homepage": "https://github.com/aiko-chan-ai/discord.js-selfbot-v13#readme",
"dependencies": { "dependencies": {
"@aikochan2k6/qrcode-terminal": "^0.12.1", "@aikochan2k6/qrcode-terminal": "^0.12.1",
"@discordjs/builders": "^1.0.0", "@discordjs/builders": "^1.1.0",
"@discordjs/collection": "^1.0.0", "@discordjs/collection": "^1.0.0",
"@discordjs/voice": "^0.11.0", "@discordjs/voice": "^0.11.0",
"@sapphire/async-queue": "^1.3.2", "@sapphire/async-queue": "^1.3.2",
@ -61,7 +61,7 @@
"axios": "^0.27.2", "axios": "^0.27.2",
"bignumber.js": "^9.0.2", "bignumber.js": "^9.0.2",
"chalk": "^4.1.2", "chalk": "^4.1.2",
"discord-api-types": "^0.36.3", "discord-api-types": "^0.37.0",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"json-bigint": "^1.0.0", "json-bigint": "^1.0.0",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
@ -81,7 +81,7 @@
"@types/node": "^16.11.12", "@types/node": "^16.11.12",
"conventional-changelog-cli": "^2.2.2", "conventional-changelog-cli": "^2.2.2",
"dtslint": "^4.2.1", "dtslint": "^4.2.1",
"eslint": "^8.20.0", "eslint": "^8.21.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3", "eslint-plugin-import": "^2.25.3",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",

View File

@ -274,7 +274,7 @@ class GuildChannelManager extends CachedManager {
nsfw: data.nsfw, nsfw: data.nsfw,
bitrate: data.bitrate ?? channel.bitrate, bitrate: data.bitrate ?? channel.bitrate,
user_limit: data.userLimit ?? channel.userLimit, user_limit: data.userLimit ?? channel.userLimit,
rtc_region: data.rtcRegion ?? channel.rtcRegion, rtc_region: 'rtcRegion' in data ? data.rtcRegion : channel.rtcRegion,
video_quality_mode: video_quality_mode:
typeof data.videoQualityMode === 'string' ? VideoQualityModes[data.videoQualityMode] : data.videoQualityMode, typeof data.videoQualityMode === 'string' ? VideoQualityModes[data.videoQualityMode] : data.videoQualityMode,
parent_id: parent, parent_id: parent,

View File

@ -592,6 +592,7 @@ class ApplicationCommand extends Base {
* @returns {Promise<InteractionResponseBody>} * @returns {Promise<InteractionResponseBody>}
*/ */
async sendSlashCommand(message, options = []) { async sendSlashCommand(message, options = []) {
// Todo: Refactor
// 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');
@ -599,7 +600,7 @@ class ApplicationCommand extends Base {
if (!Array.isArray(options)) { if (!Array.isArray(options)) {
throw new TypeError('The options must be an array of strings'); throw new TypeError('The options must be an array of strings');
} }
if (this.type !== 'CHAT_INPUT') return false; if (this.type !== 'CHAT_INPUT') throw new Error('This command is not a chat input [/]');
const optionFormat = []; const optionFormat = [];
const attachments = []; const attachments = [];
const attachmentsBuffer = []; const attachmentsBuffer = [];
@ -627,10 +628,10 @@ class ApplicationCommand extends Base {
option_[0] = { option_[0] = {
type: ApplicationCommandOptionTypes[subCommand.type], type: ApplicationCommandOptionTypes[subCommand.type],
name: subCommand.name, name: subCommand.name,
options: optionFormat, options: optionFormat.filter(obj => obj.value !== undefined),
}; };
} else { } else {
option_ = optionFormat; option_ = optionFormat.filter(obj => obj.value !== undefined);
} }
// Autoresponse // Autoresponse
const getAutoResponse = async (options_, type, name, value) => { const getAutoResponse = async (options_, type, name, value) => {
@ -702,7 +703,7 @@ class ApplicationCommand extends Base {
if (this.options[i].choices && this.options[i].choices.length > 0) { if (this.options[i].choices && this.options[i].choices.length > 0) {
choice = choice =
this.options[i].choices.find(c => c.name == value) || this.options[i].choices.find(c => c.value == value); this.options[i].choices.find(c => c.name == value) || this.options[i].choices.find(c => c.value == value);
if (!choice) { if (!choice && value) {
throw new Error( throw new Error(
`Invalid option: ${value} is not a valid choice for this option\nList of choices:\n${this.options[ `Invalid option: ${value} is not a valid choice for this option\nList of choices:\n${this.options[
i i
@ -716,8 +717,9 @@ class ApplicationCommand extends Base {
type: ApplicationCommandOptionTypes[this.options[i].type], type: ApplicationCommandOptionTypes[this.options[i].type],
name: this.options[i].name, name: this.options[i].name,
value: value:
choice?.value || choice?.value || value == undefined
(this.options[i].type == 'ATTACHMENT' ? value
: this.options[i].type == 'ATTACHMENT'
? await addDataFromAttachment(value) ? await addDataFromAttachment(value)
: this.options[i].type == 'INTEGER' : this.options[i].type == 'INTEGER'
? Number(value) ? Number(value)
@ -730,7 +732,7 @@ class ApplicationCommand extends Base {
this.options[i].name, this.options[i].name,
value, value,
) )
: value), : value,
}; };
optionFormat.push(data); optionFormat.push(data);
} else { } else {
@ -742,7 +744,7 @@ class ApplicationCommand extends Base {
choice = choice =
subCommand.options[i].choices.find(c => c.name == value) || subCommand.options[i].choices.find(c => c.name == value) ||
subCommand.options[i].choices.find(c => c.value == value); subCommand.options[i].choices.find(c => c.value == value);
if (!choice) { if (!choice && value) {
throw new Error( throw new Error(
`Invalid option: ${value} is not a valid choice for this option\nList of choices: \n${subCommand.options[ `Invalid option: ${value} is not a valid choice for this option\nList of choices: \n${subCommand.options[
i i
@ -756,8 +758,9 @@ class ApplicationCommand extends Base {
type: ApplicationCommandOptionTypes[subCommand.options[i].type], type: ApplicationCommandOptionTypes[subCommand.options[i].type],
name: subCommand.options[i].name, name: subCommand.options[i].name,
value: value:
choice?.value || choice?.value || value == undefined
(subCommand.options[i].type == 'ATTACHMENT' ? value
: subCommand.options[i].type == 'ATTACHMENT'
? await addDataFromAttachment(value) ? await addDataFromAttachment(value)
: subCommand.options[i].type == 'INTEGER' : subCommand.options[i].type == 'INTEGER'
? Number(value) ? Number(value)
@ -770,7 +773,7 @@ class ApplicationCommand extends Base {
subCommand.options[i].name, subCommand.options[i].name,
value, value,
) )
: value), : value,
}; };
optionFormat.push(data); optionFormat.push(data);
} }

View File

@ -5,7 +5,7 @@ const Invite = require('./Invite');
const { Message } = require('./Message'); const { Message } = require('./Message');
const User = require('./User'); const User = require('./User');
const { Util } = require('..'); const { Util } = require('..');
const { HypeSquadOptions, Opcodes, NitroType } = require('../util/Constants'); const { Opcodes, NitroType, HypeSquadType } = require('../util/Constants');
const DataResolver = require('../util/DataResolver'); const DataResolver = require('../util/DataResolver');
const PurchasedFlags = require('../util/PurchasedFlags'); const PurchasedFlags = require('../util/PurchasedFlags');
/** /**
@ -43,7 +43,7 @@ class ClientUser extends User {
* Nitro type of the client user. * Nitro type of the client user.
* @type {NitroType} * @type {NitroType}
*/ */
this.nitroType = nitro ?? `UNKNOWN`; this.nitroType = nitro ?? `UNKNOWN_${data.premium_type}`;
} }
if ('purchased_flags' in data) { if ('purchased_flags' in data) {
/** /**
@ -172,7 +172,7 @@ class ClientUser extends User {
* .catch(console.error); * .catch(console.error);
*/ */
setBanner(banner) { setBanner(banner) {
if (this.nitroType !== 2) { if (this.nitroType !== 'NITRO_BOOST') {
throw new Error('You must be a Nitro Boosted User to change your banner.'); throw new Error('You must be a Nitro Boosted User to change your banner.');
} }
return this.edit({ banner }); return this.edit({ banner });
@ -180,7 +180,7 @@ class ClientUser extends User {
/** /**
* Set HyperSquad House * Set HyperSquad House
* @param {HypeSquadOptions<number|string>} type * @param {HypeSquadType} type
* * `LEAVE`: 0 * * `LEAVE`: 0
* * `HOUSE_BRAVERY`: 1 * * `HOUSE_BRAVERY`: 1
* * `HOUSE_BRILLIANCE`: 2 * * `HOUSE_BRILLIANCE`: 2
@ -193,7 +193,7 @@ class ClientUser extends User {
* client.user.setHypeSquad(0); * client.user.setHypeSquad(0);
*/ */
async setHypeSquad(type) { async setHypeSquad(type) {
const id = typeof type === 'string' ? HypeSquadOptions[type] : type; const id = typeof type === 'string' ? HypeSquadType[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) {
const data = await this.client.api.hypesquad.online.post({ const data = await this.client.api.hypesquad.online.post({
@ -222,7 +222,7 @@ class ClientUser extends User {
* @returns {Promise} * @returns {Promise}
*/ */
setDiscriminator(discriminator, password) { setDiscriminator(discriminator, password) {
if (!this.nitro) throw new Error('You must be a Nitro User to change your discriminator.'); if (this.nitroType == 'NONE') throw new Error('You must be a Nitro User to change your discriminator.');
if (!password && !this.client.password) { if (!password && !this.client.password) {
throw new Error('A password is required to change a discriminator.'); throw new Error('A password is required to change a discriminator.');
} }

View File

@ -93,6 +93,13 @@ class MessageMentions {
*/ */
this._channels = null; this._channels = null;
/**
* Cached users for {@link MessageMentions#parsedUsers}
* @type {?Collection<Snowflake, User>}
* @private
*/
this._parsedUsers = null;
/** /**
* Crossposted channel data. * Crossposted channel data.
* @typedef {Object} CrosspostedChannel * @typedef {Object} CrosspostedChannel
@ -168,6 +175,23 @@ class MessageMentions {
return this._channels; return this._channels;
} }
/**
* Any user mentions that were included in the message content
* <info>Order as they appear first in the message content</info>
* @type {Collection<Snowflake, User>}
* @readonly
*/
get parsedUsers() {
if (this._parsedUsers) return this._parsedUsers;
this._parsedUsers = new Collection();
let matches;
while ((matches = this.constructor.USERS_PATTERN.exec(this._content)) !== null) {
const user = this.client.users.cache.get(matches[1]);
if (user) this._parsedUsers.set(user.id, user);
}
return this._parsedUsers;
}
/** /**
* Options used to check for a mention. * Options used to check for a mention.
* @typedef {Object} MessageMentionsHasOptions * @typedef {Object} MessageMentionsHasOptions
@ -187,14 +211,20 @@ class MessageMentions {
*/ */
has(data, { ignoreDirect = false, ignoreRoles = false, ignoreRepliedUser = false, ignoreEveryone = false } = {}) { has(data, { ignoreDirect = false, ignoreRoles = false, ignoreRepliedUser = false, ignoreEveryone = false } = {}) {
const user = this.client.users.resolve(data); const user = this.client.users.resolve(data);
const role = this.guild?.roles.resolve(data); if (!ignoreEveryone && user && this.everyone) return true;
const channel = this.client.channels.resolve(data);
const userWasRepliedTo = user && this.repliedUser?.id === user.id;
if (!ignoreRepliedUser && userWasRepliedTo && this.users.has(user.id)) return true;
if (!ignoreRepliedUser && this.users.has(this.repliedUser?.id) && this.repliedUser?.id === user?.id) return true; if (!ignoreRepliedUser && this.users.has(this.repliedUser?.id) && this.repliedUser?.id === user?.id) return true;
if (!ignoreDirect) { if (!ignoreDirect) {
if (this.users.has(user?.id)) return true; if (user && (!ignoreRepliedUser || this.parsedUsers.has(user.id)) && this.users.has(user.id)) return true;
if (this.roles.has(role?.id)) return true;
if (this.channels.has(channel?.id)) return true; const role = this.guild?.roles.resolve(data);
if (role && this.roles.has(role.id)) return true;
const channel = this.client.channels.resolve(data);
if (channel && this.channels.has(channel.id)) return true;
} }
if (user && !ignoreEveryone && this.everyone) return true; if (user && !ignoreEveryone && this.everyone) return true;
if (!ignoreRoles) { if (!ignoreRoles) {

View File

@ -8,7 +8,7 @@ const getUUID = () =>
([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, a => (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)); ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, a => (a ^ ((Math.random() * 16) >> (a / 4))).toString(16));
// Function check url valid (ok copilot) // Function check url valid (ok copilot)
// eslint-disable-next-line // eslint-disable-next-line
const checkUrl = url=> /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(url); const checkUrl = url => /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(url);
class CustomStatus { class CustomStatus {
/** /**

View File

@ -398,6 +398,15 @@ class TextBasedChannel {
* @param {string} commandName Command name * @param {string} commandName Command name
* @param {...?string|string[]} args Command arguments * @param {...?string|string[]} args Command arguments
* @returns {Promise<InteractionResponseBody>} * @returns {Promise<InteractionResponseBody>}
* @example
* // Send Slash to this channel
* // Demo:
* // + BotID: "123456789012345678"
* // + CommandName: "embed"
* // + Args: "title", "description", "author", 'color' (Optional)
* channel.sendSlash('123456789012345678', 'embed', 'title', 'description', 'author', '#00ff00')
* // Send embed with Title and Color:
* channel.sendSlash('123456789012345678', 'embed', 'title', undefined, undefined, '#00ff00')
*/ */
async sendSlash(botId, commandName, ...args) { async sendSlash(botId, commandName, ...args) {
args = args.flat(2); args = args.flat(2);

View File

@ -59,6 +59,16 @@ exports.stickerAnimationMode = createEnum(['ALWAYS', 'INTERACTION', 'NEVER']);
*/ */
exports.NitroType = createEnum(['NONE', 'NITRO_CLASSIC', 'NITRO_BOOST']); exports.NitroType = createEnum(['NONE', 'NITRO_CLASSIC', 'NITRO_BOOST']);
/**
* All available HypeSquad types:
* * `LEAVE` - None
* * `HOUSE_BRAVERY` - HypeSquad Bravery
* * `HOUSE_BRILLIANCE` - HypeSquad Brilliance
* * `HOUSE_BALANCE` - HypeSquad Balance
* @typedef {string} HypeSquadType
*/
exports.HypeSquadType = createEnum(['LEAVE', 'HOUSE_BRAVERY', 'HOUSE_BRILLIANCE', 'HOUSE_BALANCE']);
exports.localeObject = { exports.localeObject = {
da: 'DANISH', da: 'DANISH',
de: 'GERMAN', de: 'GERMAN',
@ -1584,8 +1594,6 @@ exports.GuildScheduledEventEntityTypes = createEnum([null, 'STAGE_INSTANCE', 'VO
*/ */
exports.VideoQualityModes = createEnum([null, 'AUTO', 'FULL']); exports.VideoQualityModes = createEnum([null, 'AUTO', 'FULL']);
exports.HypeSquadOptions = createEnum(['LEAVE', 'HOUSE_BRAVERY', 'HOUSE_BRILLIANCE', 'HOUSE_BALANCE']);
exports._cleanupSymbol = Symbol('djsCleanup'); exports._cleanupSymbol = Symbol('djsCleanup');
function keyMirror(arr) { function keyMirror(arr) {

File diff suppressed because it is too large Load Diff

3
typings/enums.d.ts vendored
View File

@ -166,7 +166,8 @@ export const enum GuildScheduledEventStatuses {
CANCELED = 4, CANCELED = 4,
} }
export const enum HypeSquadOptions { export const enum HypeSquadType {
LEAVE = 0,
HOUSE_BRAVERY = 1, HOUSE_BRAVERY = 1,
HOUSE_BRILLIANCE = 2, HOUSE_BRILLIANCE = 2,
HOUSE_BALANCE = 3, HOUSE_BALANCE = 3,

7
typings/index.d.ts vendored
View File

@ -98,7 +98,7 @@ import {
GuildScheduledEventEntityTypes, GuildScheduledEventEntityTypes,
GuildScheduledEventStatuses, GuildScheduledEventStatuses,
GuildScheduledEventPrivacyLevels, GuildScheduledEventPrivacyLevels,
HypeSquadOptions, HypeSquadType,
VideoQualityModes, VideoQualityModes,
} from './enums'; } from './enums';
import { import {
@ -897,7 +897,7 @@ 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): Promise<void>; public setHypeSquad(type: HypeSquadType): 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>;
@ -2104,13 +2104,14 @@ export class MessageMentions {
private _channels: Collection<Snowflake, AnyChannel> | null; private _channels: Collection<Snowflake, AnyChannel> | null;
private readonly _content: string; private readonly _content: string;
private _members: Collection<Snowflake, GuildMember> | null; private _members: Collection<Snowflake, GuildMember> | null;
private _parsedUsers: Collection<Snowflake, User> | null;
public readonly channels: Collection<Snowflake, AnyChannel>; public readonly channels: Collection<Snowflake, AnyChannel>;
public readonly client: Client; public readonly client: Client;
public everyone: boolean; public everyone: boolean;
public readonly guild: Guild; public readonly guild: Guild;
public has(data: UserResolvable | RoleResolvable | ChannelResolvable, options?: MessageMentionsHasOptions): boolean; public has(data: UserResolvable | RoleResolvable | ChannelResolvable, options?: MessageMentionsHasOptions): boolean;
public readonly members: Collection<Snowflake, GuildMember> | null; public readonly members: Collection<Snowflake, GuildMember> | null;
public readonly parsedUsers: Collection<Snowflake, User>;
public repliedUser: User | null; public repliedUser: User | null;
public roles: Collection<Snowflake, Role>; public roles: Collection<Snowflake, Role>;
public users: Collection<Snowflake, User>; public users: Collection<Snowflake, User>;