diff --git a/options.json b/options.json index 007e270..eb766e3 100644 --- a/options.json +++ b/options.json @@ -9,18 +9,18 @@ "clientOptions": { "commentedOut": ["GUILD_PRESENCES","REACTION","MESSAGE","USER"], "partials": [ - "CHANNEL" + "Channel" ], "intents": [ - "GUILDS", - "GUILD_MEMBERS", - "GUILD_MESSAGES", - "GUILD_VOICE_STATES", - "GUILD_WEBHOOKS", - "GUILD_BANS", - - "GUILD_MESSAGE_REACTIONS", - "DIRECT_MESSAGES" + "Guilds", + "GuildMembers", + "GuildMessages", + "MessageContent", + "GuildVoiceStates", + "GuildWebhooks", + "GuildBans", + "GuildMessageReactions", + "DirectMessages" ], "invalidRequestWarningInterval": 500 }, @@ -31,7 +31,8 @@ "slashCommands": { "developerGuilds": [ "264527028751958016", - "207880433432657920" + "207880433432657920", + "992757341848080486" ] } }, diff --git a/package.json b/package.json index 7666f1b..7a7967a 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,10 @@ "dependencies": { "@discordjs/collection": "^0.2.1", "@discordjs/rest": "^0.1.0-canary.0", + "@navy.gif/timestring": "^6.0.0", "chalk": "^4.1.2", "common-tags": "^1.8.2", - "discord.js": "^13.5.1", + "discord.js": "^14.0.3", "dotenv": "^10.0.0", "escape-string-regexp": "4.0.0", "humanize-duration": "^3.27.1", @@ -34,8 +35,7 @@ "mongodb": "^4.5.0", "node-fetch": "2", "object-hash": "^3.0.0", - "similarity": "^1.2.1", - "@navy.gif/timestring": "^6.0.0" + "similarity": "^1.2.1" }, "devDependencies": { "babel-eslint": "^10.1.0", diff --git a/src/constants/Constants.js b/src/constants/Constants.js index 0ac5e6b..925646b 100644 --- a/src/constants/Constants.js +++ b/src/constants/Constants.js @@ -6,37 +6,38 @@ exports.UploadLimit = { }; exports.PermissionNames = { - CREATE_INSTANT_INVITE: "Create Invite", - KICK_MEMBERS: "Kick Members", - BAN_MEMBERS: "Ban Members", - ADMINISTRATOR: "Administrator", - MANAGE_CHANNELS: "Manage Channels", - MANAGE_GUILD: "Manage Server", - ADD_REACTIONS: "Add Reactions", - VIEW_AUDIT_LOG: "View Audit Log", - PRIORITY_SPEAKER: "Priority Speaker", - STREAM: "Video", - VIEW_CHANNEL: "Read Messages", - SEND_MESSAGES: "Send Messages", - SEND_TTS_MESSAGES: "Send TTS Messages", - MANAGE_MESSAGES: "Manage Messages", - EMBED_LINKS: "Embed Links", - ATTACH_FILES: "Attach Files", - READ_MESSAGE_HISTORY: "Read Message History", - MENTION_EVERYONE: "Mention @everyone", - USE_EXTERNAL_EMOJIS: "Use External Emojis", - VIEW_GUILD_INSIGHTS: "View Server Insights", - CONNECT: "Connect", - SPEAK: "Speak", - MUTE_MEMBERS: "Mute Members", - DEAFEN_MEMBERS: "Deafen Members", - MOVE_MEMBERS: "Move Members", - USE_VAD: "Use Voice Activity", - CHANGE_NICKNAME: "Change Nickname", - MANAGE_NICKNAMES: "Manage Nicknames", - MANAGE_ROLES: "Manage Roles", - MANAGE_WEBHOOKS: "Manage Webhooks", - MANAGE_EMOJIS: "Manage Emojis" + CreateInstantInvite: "Create Invite", + KickMembers: "Kick Members", + BanMembers: "Ban Members", + Administrator: "Administrator", + ManageChannels: "Manage Channels", + ManageGuild: "Manage Server", + AddReactions: "Add Reactions", + ViewAuditLog: "View Audit Log", + PrioritySpeaker: "Priority Speaker", + Stream: "Video", + ViewChannel: "Read Messages", + SendMessages: "Send Messages", + SendTTSMessages: "Send TTS Messages", + ManageMessages: "Manage Messages", + EmbedLinks: "Embed Links", + AttachFiles: "Attach Files", + ReadMessageHistory: "Read Message History", + MentionEveryone: "Mention @everyone", + UseExternalEmojis: "Use External Emojis", + ViewGuildInsights: "View Server Insights", + Connect: "Connect", + Speak: "Speak", + MuteMembers: "Mute Members", + DeafenMembers: "Deafen Members", + MoveMembers: "Move Members", + UseVAD: "Use Voice Activity", + ChangeNickname: "Change Nickname", + ManageNicknames: "Manage Nicknames", + ManageRoles: "Manage Roles", + ManageWebhooks: "Manage Webhooks", + ManageEmojis: "Manage Emojis", + ModerateMembers: 'Moderate Members' }; exports.EmbedLimits = { diff --git a/src/localization/en_gb/settings/en_gb_logging.lang b/src/localization/en_gb/settings/en_gb_logging.lang index ade0fd0..629577d 100644 --- a/src/localization/en_gb/settings/en_gb_logging.lang +++ b/src/localization/en_gb/settings/en_gb_logging.lang @@ -1,6 +1,6 @@ [SETTING_MESSAGES_HELP] Configure message logging for your server. -Message logging utilizes webhooks for bulk message deletions, so if you wish to log those, make sure the bot has the `MANAGE_WEBHOOKS` permission in the logging channel! +Message logging utilizes webhooks for bulk message deletions, so if you wish to log those, make sure the bot has the `ManageWebhooks` permission in the logging channel! If you've given the permission retroactively, make sure to reconfigure the channel to ensure the bot creates the webhook. [SETTING_MEMBERS_HELP] diff --git a/src/localization/en_gb/settings/en_gb_moderation.lang b/src/localization/en_gb/settings/en_gb_moderation.lang index bc8d185..3fb6b59 100644 --- a/src/localization/en_gb/settings/en_gb_moderation.lang +++ b/src/localization/en_gb/settings/en_gb_moderation.lang @@ -268,7 +268,7 @@ Successfully updated **{setting}**. Cannot use both `role` and `create` at the same time. [SETTING_MUTE_ROLEMISSINGPERMISSION] -The bot *must have* the `MANAGE_ROLES` permission to create a new mute role. +The bot *must have* the `ManageRoles` permission to create a new mute role. [SETTING_MUTE_ROLECREATEERROR] The bot encountered an issue while creating a role for the guild. diff --git a/src/structure/DiscordClient.js b/src/structure/DiscordClient.js index e89c735..f95be3b 100644 --- a/src/structure/DiscordClient.js +++ b/src/structure/DiscordClient.js @@ -56,6 +56,21 @@ class DiscordClient extends Client { this._built = false; this._evals = new Collection(); + // As of d.js v14 these events are emitted from the rest manager, rebinding them to the client + this.rest.on('request', (...args) => { + this.emit('apiRequest', ...args); + }); + + this.rest.on('response', (...args) => { + this.emit('apiResponse', ...args); + }); + + this.rest.on('rateLimited', (...args) => { + this.emit('rateLimit', ...args); + }); + + this.ws.on('onmessage', (data) => console.log(data)); + // this.once('ready', () => { // this._setActivity(); diff --git a/src/structure/client/ModerationManager.js b/src/structure/client/ModerationManager.js index fe614f7..bb2b610 100644 --- a/src/structure/client/ModerationManager.js +++ b/src/structure/client/ModerationManager.js @@ -359,7 +359,6 @@ class ModerationManager { const responses = {}; for (const arg of Object.values(args)) { - // console.log(arg, targets); if (this.actions[arg.name]) { const action = await this.actions[arg.name](invoker, arg, targets); responses[arg.name] = action; @@ -400,7 +399,7 @@ class ModerationManager { } if (target) { - const executor = guild.members.resolve(i.executor) || guild.me; + const executor = guild.members.resolve(i.executor) || guild.members.me; try { await new undoClass(this.client, { diff --git a/src/structure/client/RateLimiter.js b/src/structure/client/RateLimiter.js index 1650683..9035b3c 100644 --- a/src/structure/client/RateLimiter.js +++ b/src/structure/client/RateLimiter.js @@ -37,7 +37,7 @@ class RateLimiter { if (!channel || !(channel instanceof TextChannel)) reject(new Error('Missing channel')); if (!message || !(message instanceof Message)) reject(new Error('Missing message')); - if (!channel.permissionsFor(channel.guild.me).has('MANAGE_MESSAGES')) reject(new Error('Missing permission MANAGE_MESSAGES')); + if (!channel.permissionsFor(channel.guild.members.me).has('ManageMessages')) reject(new Error('Missing permission ManageMessages')); if (!this.deleteQueue[channel.id]) this.deleteQueue[channel.id] = []; this.deleteQueue[channel.id].push({ message, resolve, reject }); @@ -106,7 +106,7 @@ class RateLimiter { if (!channel || !(channel instanceof TextChannel)) reject(new Error('Missing channel.')); if (!message || !message.length) reject(new Error('Missing message.')); - if (!channel.permissionsFor(channel.guild.me).has('SEND_MESSAGES')) reject(new Error('Missing permission SEND_MESSAGES')); + if (!channel.permissionsFor(channel.guild.members.me).has('SendMessages')) reject(new Error('Missing permission SendMessages')); //Initiate queue if (!this.sendQueue[channel.id]) this.sendQueue[channel.id] = []; @@ -173,7 +173,7 @@ class RateLimiter { return new Promise((resolve, reject) => { if (!channel || !(channel instanceof TextChannel)) reject(new Error('Missing channel')); - if (!channel.permissionsFor(channel.guild.me).has('SEND_MESSAGES')) reject(new Error('Missing permission SEND_MESSAGES')); + if (!channel.permissionsFor(channel.guild.members.me).has('SendMessages')) reject(new Error('Missing permission SendMessages')); if (!message) reject(new Error('Missing message')); if (limit === null) limit = 15; diff --git a/src/structure/client/wrappers/GuildWrapper.js b/src/structure/client/wrappers/GuildWrapper.js index 16c22d0..d05d09d 100644 --- a/src/structure/client/wrappers/GuildWrapper.js +++ b/src/structure/client/wrappers/GuildWrapper.js @@ -120,7 +120,7 @@ class GuildWrapper { async checkInvite(code) { // Is maintained by the utility hook - if (!this.invites && this.me.permissions.has('MANAGE_GUILD')) this.invites = await this.fetchInvites(); + if (!this.invites && this.me.permissions.has('ManageGuild')) this.invites = await this.fetchInvites(); return this.invites?.has(code) || false; } @@ -239,7 +239,7 @@ class GuildWrapper { const result = await this.client.storageManager.mongodb.webhooks.findOne({ feature, guild: this.id }); if (!result) return null; - if (!this.me.permissions.has('MANAGE_WEBHOOKS')) throw new Error('Missing MANAGE_WEBHOOKS'); + if (!this.me.permissions.has('ManageWebhooks')) throw new Error('Missing ManageWebhooks'); const hooks = await this.fetchWebhooks(); const hook = hooks.get(result.hookID); if (!hook) return null; @@ -391,7 +391,7 @@ class GuildWrapper { } get me() { - return this.guild.me; + return this.guild.members.me; } get memberCount() { diff --git a/src/structure/client/wrappers/InteractionWrapper.js b/src/structure/client/wrappers/InteractionWrapper.js index f122889..debd3d8 100644 --- a/src/structure/client/wrappers/InteractionWrapper.js +++ b/src/structure/client/wrappers/InteractionWrapper.js @@ -1,4 +1,4 @@ -const { Guild } = require('discord.js'); +const { Guild, InteractionType } = require('discord.js'); const GuildWrapper = require('./GuildWrapper.js'); class InteractionWrapper { @@ -212,7 +212,7 @@ class InteractionWrapper { } isCommand() { - return this.interaction.isCommand(); + return this.interaction.type === InteractionType.ApplicationCommand; } isContextMenu() { diff --git a/src/structure/client/wrappers/MemberWrapper.js b/src/structure/client/wrappers/MemberWrapper.js index 6d24586..cfbc3f3 100644 --- a/src/structure/client/wrappers/MemberWrapper.js +++ b/src/structure/client/wrappers/MemberWrapper.js @@ -35,7 +35,7 @@ class MemberWrapper { } async isAdmin() { - return (await this.userWrapper()).developer || this.permissions.any(['ADMINISTRATOR', 'MANAGE_GUILD']); + return (await this.userWrapper()).developer || this.permissions.any(['Administrator', 'ManageGuild']); } timeout(...opts) { diff --git a/src/structure/components/commands/administration/Import.js b/src/structure/components/commands/administration/Import.js index b9f2180..1e6b213 100644 --- a/src/structure/components/commands/administration/Import.js +++ b/src/structure/components/commands/administration/Import.js @@ -17,7 +17,7 @@ class ImportCommand extends SlashCommand { description: 'Import old settings & modlogs', module: 'administration', guildOnly: true, - memberPermissions: ['ADMINISTRATOR'], + memberPermissions: ['Administrator'], options: [{ name: ['settings'], type: 'SUB_COMMAND', diff --git a/src/structure/components/commands/administration/Modstats.js b/src/structure/components/commands/administration/Modstats.js index aaaa1b0..b73bad3 100644 --- a/src/structure/components/commands/administration/Modstats.js +++ b/src/structure/components/commands/administration/Modstats.js @@ -1,4 +1,4 @@ -const { MessageAttachment } = require("discord.js"); +const { AttachmentBuilder } = require("discord.js"); const { SlashCommand } = require("../../../interfaces"); class ModstatsCommand extends SlashCommand { @@ -9,8 +9,8 @@ class ModstatsCommand extends SlashCommand { description: 'Aggregate moderation statistics', module: 'administration', guildOnly: true, - memberPermissions: ['MANAGE_GUILD'], - clientPermissions: ['ATTACH_FILES'], + memberPermissions: ['ManageGuild'], + clientPermissions: ['AttachFiles'], options: [ { name: ['after', 'before'], @@ -46,7 +46,7 @@ class ModstatsCommand extends SlashCommand { const data = await this.client.mongodb.infractions.find(query, { projection: { executor: 1, type: 1 } }); for (const log of data) { - if (log.executor === guild.me.id) continue; + if (log.executor === guild.members.me.id) continue; if (!result[log.executor]) { const user = await this.client.resolveUser(log.executor); result[log.executor] = { name: user.tag }; @@ -75,7 +75,7 @@ class ModstatsCommand extends SlashCommand { } - const attachment = new MessageAttachment(Buffer.from(JSON.stringify(result, null, 4)), `modstats-${guild.name}-${now}.json`); + const attachment = new AttachmentBuilder(Buffer.from(JSON.stringify(result, null, 4)), { name: `modstats-${guild.name}-${now}.json` }); return invoker.reply({ files: [attachment] }); } diff --git a/src/structure/components/commands/administration/Permissions.js b/src/structure/components/commands/administration/Permissions.js index 4b741a0..eecb64b 100644 --- a/src/structure/components/commands/administration/Permissions.js +++ b/src/structure/components/commands/administration/Permissions.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const { Emojis } = require("../../../../constants"); const { SlashCommand } = require("../../../interfaces"); @@ -13,7 +13,7 @@ class PermissionsCommand extends SlashCommand { description: 'Manage permissions for users and roles', module: 'administration', guildOnly: true, - memberPermissions: ['MANAGE_GUILD'], + memberPermissions: ['ManageGuild'], options: [ { name: ['grant', 'revoke'], @@ -346,7 +346,7 @@ class PermissionsCommand extends SlashCommand { if (fields.length) embed.fields.push(...fields); - return new MessageEmbed(embed); + return new EmbedBuilder(embed); } diff --git a/src/structure/components/commands/administration/Settings.js b/src/structure/components/commands/administration/Settings.js index 25008f6..9ef32de 100644 --- a/src/structure/components/commands/administration/Settings.js +++ b/src/structure/components/commands/administration/Settings.js @@ -16,7 +16,7 @@ class SettingsCommand extends SlashCommand { type: 'SUB_COMMAND' }) ], - memberPermissions: ['MANAGE_GUILD'] + memberPermissions: ['ManageGuild'] }); } diff --git a/src/structure/components/commands/developer/Stats.js b/src/structure/components/commands/developer/Stats.js index 33d44fb..4cfaa43 100644 --- a/src/structure/components/commands/developer/Stats.js +++ b/src/structure/components/commands/developer/Stats.js @@ -20,7 +20,7 @@ class StatsCommand extends SlashCommand { description: 'Logs the output in the console.' } ], - clientPermissions: ['SEND_MESSAGES', 'EMBED_LINKS'], + clientPermissions: ['SendMessages', 'EmbedLinks'], showUsage: false, archivable: false }); diff --git a/src/structure/components/commands/information/Commands.js b/src/structure/components/commands/information/Commands.js index b0d6fa7..00f7d8c 100644 --- a/src/structure/components/commands/information/Commands.js +++ b/src/structure/components/commands/information/Commands.js @@ -15,7 +15,7 @@ class Commands extends SlashCommand { type: 'MODULE', description: ['List commands from a specific module'] }], - memberPermissions: ['MANAGE_GUILD'], + memberPermissions: ['ManageGuild'], guildOnly: true }); } diff --git a/src/structure/components/commands/information/Guild.js b/src/structure/components/commands/information/Guild.js index 409b9e3..c3e0a9c 100644 --- a/src/structure/components/commands/information/Guild.js +++ b/src/structure/components/commands/information/Guild.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const { SlashCommand } = require("../../../interfaces"); const Tiers = { @@ -112,7 +112,7 @@ class GuildCommand extends SlashCommand { inline: true }); - return new MessageEmbed(embed); + return new EmbedBuilder(embed); } diff --git a/src/structure/components/commands/information/Help.js b/src/structure/components/commands/information/Help.js index dc68261..d05fb21 100644 --- a/src/structure/components/commands/information/Help.js +++ b/src/structure/components/commands/information/Help.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const { SlashCommand } = require("../../../interfaces"); class HelpCommand extends SlashCommand { @@ -22,7 +22,7 @@ class HelpCommand extends SlashCommand { // TODO: probably needs to be expanded a bit, but fine for now const { component } = opts; - if (!component) return new MessageEmbed({ + if (!component) return new EmbedBuilder({ description: interaction.format('COMMAND_HELP') }); diff --git a/src/structure/components/commands/information/Info.js b/src/structure/components/commands/information/Info.js index b1b1343..ef46130 100644 --- a/src/structure/components/commands/information/Info.js +++ b/src/structure/components/commands/information/Info.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const { Emojis } = require("../../../../constants"); const { Util } = require("../../../../utilities"); const { SlashCommand, CommandError } = require("../../../interfaces"); @@ -130,7 +130,7 @@ class InformationCommand extends SlashCommand { } - return new MessageEmbed(response); + return new EmbedBuilder(response); } @@ -159,7 +159,7 @@ class InformationCommand extends SlashCommand { embed.description += interaction.format('COMMAND_INFO_ROLE_ICON', { url }); } - return new MessageEmbed(embed); + return new EmbedBuilder(embed); } @@ -167,7 +167,7 @@ class InformationCommand extends SlashCommand { if (!interaction.guild) return { emoji: 'failure', index: 'COMMAND_INFO_GUILDONLY_CHANNEL' }; const perms = channel.permissionsFor(interaction.member); - if (perms.missing('VIEW_CHANNEL').length) throw new CommandError(interaction, { index: 'ERR_MISSING_PERMISSIONS' }); + if (perms.missing('ViewChannel').length) throw new CommandError(interaction, { index: 'ERR_MISSING_PERMISSIONS' }); const embed = { title: channel.name, @@ -199,7 +199,7 @@ class InformationCommand extends SlashCommand { }); } - return new MessageEmbed(embed); + return new EmbedBuilder(embed); } diff --git a/src/structure/components/commands/information/Privacy.js b/src/structure/components/commands/information/Privacy.js index faf977c..902109c 100644 --- a/src/structure/components/commands/information/Privacy.js +++ b/src/structure/components/commands/information/Privacy.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const { SlashCommand } = require("../../../interfaces"); class PrivacyCommand extends SlashCommand { @@ -15,7 +15,7 @@ class PrivacyCommand extends SlashCommand { async execute(interaction) { - return new MessageEmbed({ + return new EmbedBuilder({ title: interaction.format('COMMAND_PRIVACY_TITLE'), description: interaction.format('COMMAND_PRIVACY_POLICY') }); diff --git a/src/structure/components/commands/moderation/Ban.js b/src/structure/components/commands/moderation/Ban.js index 49c1398..b5ce5b9 100644 --- a/src/structure/components/commands/moderation/Ban.js +++ b/src/structure/components/commands/moderation/Ban.js @@ -29,8 +29,8 @@ class BanCommand extends ModerationCommand { ], showUsage: true, guildOnly: true, - memberPermissions: ['BAN_MEMBERS'], - clientPermissions: ['BAN_MEMBERS'], + memberPermissions: ['BanMembers'], + clientPermissions: ['BanMembers'], skipOptions: ['prune'] }); diff --git a/src/structure/components/commands/moderation/Case.js b/src/structure/components/commands/moderation/Case.js index c9b9b90..ad1aa14 100644 --- a/src/structure/components/commands/moderation/Case.js +++ b/src/structure/components/commands/moderation/Case.js @@ -27,8 +27,8 @@ class CaseCommand extends SlashCommand { }], guildOnly: true, showUsage: true, - clientPermissions: ['MANAGE_MESSAGES'], - memberPermissions: ['MANAGE_MESSAGES'] + clientPermissions: ['ManageMessages'], + memberPermissions: ['ManageMessages'] }); } diff --git a/src/structure/components/commands/moderation/Dehoist.js b/src/structure/components/commands/moderation/Dehoist.js index 19f79c4..a8745da 100644 --- a/src/structure/components/commands/moderation/Dehoist.js +++ b/src/structure/components/commands/moderation/Dehoist.js @@ -9,8 +9,8 @@ class DehoistCommand extends ModerationCommand { description: 'Removes hoisting characters from users\' display names', module: 'moderation', options: [ ], - memberPermissions: ['MANAGE_NICKNAMES'], - clientPermissions: ['MANAGE_NICKNAMES'], + memberPermissions: ['ManageNicknames'], + clientPermissions: ['ManageNicknames'], guildOnly: true }); diff --git a/src/structure/components/commands/moderation/Edit.js b/src/structure/components/commands/moderation/Edit.js index 2d90b65..3133dcb 100644 --- a/src/structure/components/commands/moderation/Edit.js +++ b/src/structure/components/commands/moderation/Edit.js @@ -9,7 +9,7 @@ class EditCommand extends SlashCommand { module: 'moderation', showUsage: true, guildOnly: true, - memberPermissions: ['MANAGE_MESSAGES'], + memberPermissions: ['ManageMessages'], options: [{ name: 'case', type: 'INTEGER', diff --git a/src/structure/components/commands/moderation/History.js b/src/structure/components/commands/moderation/History.js index 63f8d06..e8678f5 100644 --- a/src/structure/components/commands/moderation/History.js +++ b/src/structure/components/commands/moderation/History.js @@ -1,5 +1,5 @@ const { stripIndents } = require("common-tags"); -const { MessageAttachment } = require("discord.js"); +const { AttachmentBuilder } = require("discord.js"); const moment = require('moment'); const { Infractions, UploadLimit } = require("../../../../constants/Constants"); const { Util } = require("../../../../utilities"); @@ -18,8 +18,8 @@ class HistoryCommand extends SlashCommand { name: 'history', description: 'List past infractions', module: 'moderation', - memberPermissions: ['MANAGE_MESSAGES'], - clientPermissions: ['EMBED_LINKS'], + memberPermissions: ['ManageMessages'], + clientPermissions: ['EmbedLinks'], guildOnly: true, options: [{ name: ['before', 'after'], @@ -104,7 +104,7 @@ class HistoryCommand extends SlashCommand { footer: { text: `• Page ${_page}/${maxPage} | ${resultsAmt} Results` }, - color: invoker.guild.me.roles.highest.color + color: invoker.guild.members.me.roles.highest.color }; if (invoker.guild._settings.modpoints.enabled) { @@ -201,7 +201,7 @@ class HistoryCommand extends SlashCommand { if(!member || !member.isAdmin()) return { emoji: 'failure', index: 'COMMAND_HISTORY_NO_EXPORT_PERMS' }; const logs = await this.client.storageManager.mongodb.infractions.find({ guild: invoker.guild.id }, { projection: { _id: 0 } }); const string = JSON.stringify(logs); - const attachment = new MessageAttachment(Buffer.from(string), `${invoker.guild.id}-moderation.json`); + const attachment = new AttachmentBuilder(Buffer.from(string), { name: `${invoker.guild.id}-moderation.json` }); const bytes = Buffer.byteLength(attachment.attachment); diff --git a/src/structure/components/commands/moderation/Kick.js b/src/structure/components/commands/moderation/Kick.js index 61152b8..79e6471 100644 --- a/src/structure/components/commands/moderation/Kick.js +++ b/src/structure/components/commands/moderation/Kick.js @@ -11,8 +11,8 @@ class KickCommand extends ModerationCommand { options: [], guildOnly: true, showUsage: true, - memberPermissions: ['KICK_MEMBERS'], - clientPermissions: ['KICK_MEMBERS'], + memberPermissions: ['KickMembers'], + clientPermissions: ['KickMembers'], }); } diff --git a/src/structure/components/commands/moderation/Lockdown.js b/src/structure/components/commands/moderation/Lockdown.js index d17f7f0..5ff4051 100644 --- a/src/structure/components/commands/moderation/Lockdown.js +++ b/src/structure/components/commands/moderation/Lockdown.js @@ -20,8 +20,8 @@ class LockdownCommand extends ModerationCommand { }], guildOnly: true, showUsage: true, - memberPermissions: ['MANAGE_CHANNELS'], - clientPermissions: ['MANAGE_CHANNELS', 'MANAGE_ROLES'], + memberPermissions: ['ManageChannels'], + clientPermissions: ['ManageChannels', 'ManageRoles'], skipOptions: ['users', 'points', 'expiration', 'force', 'silent'] }); diff --git a/src/structure/components/commands/moderation/Modtimers.js b/src/structure/components/commands/moderation/Modtimers.js index 645c771..cf22ccf 100644 --- a/src/structure/components/commands/moderation/Modtimers.js +++ b/src/structure/components/commands/moderation/Modtimers.js @@ -7,8 +7,8 @@ class ModtimersCommand extends SlashCommand { name: 'modtimers', description: 'List active timed infractions', module: 'moderation', - memberPermissions: ['MANAGE_MESSAGES'], - clientPermissions: ['EMBED_LINKS'], + memberPermissions: ['ManageMessages'], + clientPermissions: ['EmbedLinks'], guildOnly: true }); } diff --git a/src/structure/components/commands/moderation/Mute.js b/src/structure/components/commands/moderation/Mute.js index 37cb2bd..a605b47 100644 --- a/src/structure/components/commands/moderation/Mute.js +++ b/src/structure/components/commands/moderation/Mute.js @@ -15,8 +15,8 @@ class MuteCommand extends ModerationCommand { }], guildOnly: true, showUsage: true, - memberPermissions: ['MODERATE_MEMBERS'], - // clientPermissions: ['MODERATE_MEMBERS', 'MANAGE_ROLES'] + memberPermissions: ['ModerateMembers'], + // clientPermissions: ['ModerateMembers', 'ManageRoles'] // Mute client permissions are handled in the infraction.verify due to being able to use both timeout and role based mutes }); } @@ -27,8 +27,8 @@ class MuteCommand extends ModerationCommand { const { guild } = interaction; const settings = await guild.settings(); const { type } = settings.mute; - if (type === 3 && !guild.me.permissions.has('MODERATE_MEMBERS')) throw new CommandError(interaction, { index: 'INHIBITOR_CLIENTPERMISSIONS_ERROR', params: { command: this.name, missing: 'MODERATE_MEMBERS' } }); - else if (!guild.me.permissions.has('MANAGE_ROLES')) throw new CommandError(interaction, { index: 'INHIBITOR_CLIENTPERMISSIONS_ERROR', params: { command: this.name, missing: 'MANAGE_ROLES' } }); + if (type === 3 && !guild.members.me.permissions.has('ModerateMembers')) throw new CommandError(interaction, { index: 'INHIBITOR_CLIENTPERMISSIONS_ERROR', params: { command: this.name, missing: 'ModerateMembers' } }); + else if (!guild.members.me.permissions.has('ManageRoles')) throw new CommandError(interaction, { index: 'INHIBITOR_CLIENTPERMISSIONS_ERROR', params: { command: this.name, missing: 'ManageRoles' } }); return this.client.moderationManager.handleInfraction(Mute, interaction, { targets: users.value, diff --git a/src/structure/components/commands/moderation/Nickname.js b/src/structure/components/commands/moderation/Nickname.js index 709f72d..9d87e2d 100644 --- a/src/structure/components/commands/moderation/Nickname.js +++ b/src/structure/components/commands/moderation/Nickname.js @@ -13,8 +13,8 @@ class NicknameCommand extends ModerationCommand { description: 'The new nickname to give', type: 'STRING' }], - memberPermissions: ['MANAGE_NICKNAMES'], - clientPermissions: ['MANAGE_NICKNAMES'], + memberPermissions: ['ManageNicknames'], + clientPermissions: ['ManageNicknames'], guildOnly: true }); diff --git a/src/structure/components/commands/moderation/Note.js b/src/structure/components/commands/moderation/Note.js index c9168b2..c9351ba 100644 --- a/src/structure/components/commands/moderation/Note.js +++ b/src/structure/components/commands/moderation/Note.js @@ -9,7 +9,7 @@ class NoteCommand extends ModerationCommand { module: 'moderation', showUsage: true, guildOnly: true, - memberPermissions: ['MANAGE_MESSAGES'], + memberPermissions: ['ManageMessages'], options: [{ name: 'users', type: 'USERS', diff --git a/src/structure/components/commands/moderation/Prune.js b/src/structure/components/commands/moderation/Prune.js index 14da16b..412ac0b 100644 --- a/src/structure/components/commands/moderation/Prune.js +++ b/src/structure/components/commands/moderation/Prune.js @@ -85,8 +85,8 @@ class PruneCommand extends ModerationCommand { overrideOptions: true, guildOnly: true, showUsage: true, - memberPermissions: ['MANAGE_CHANNELS'], - clientPermissions: ['MANAGE_MESSAGES'], + memberPermissions: ['ManageChannels'], + clientPermissions: ['ManageMessages'], }); } diff --git a/src/structure/components/commands/moderation/Resolve.js b/src/structure/components/commands/moderation/Resolve.js index 526c02e..f38bec7 100644 --- a/src/structure/components/commands/moderation/Resolve.js +++ b/src/structure/components/commands/moderation/Resolve.js @@ -7,7 +7,7 @@ class ResolveCommand extends SlashCommand { name: 'resolve', description: 'Resolve infraction(s)', module: 'moderation', - memberPermissions: ['MANAGE_GUILD'], + memberPermissions: ['ManageGuild'], guildOnly: true, options: [{ name: 'case', diff --git a/src/structure/components/commands/moderation/Roles.js b/src/structure/components/commands/moderation/Roles.js index b91583a..a01c73d 100644 --- a/src/structure/components/commands/moderation/Roles.js +++ b/src/structure/components/commands/moderation/Roles.js @@ -32,8 +32,8 @@ class AddroleCommand extends ModerationCommand { }] }, ], - memberPermissions: ['MANAGE_ROLES'], - clientPermissions: ['MANAGE_ROLES'], + memberPermissions: ['ManageRoles'], + clientPermissions: ['ManageRoles'], skipOptions: ['points', 'expiration', 'force', 'prune'] }); diff --git a/src/structure/components/commands/moderation/Slowmode.js b/src/structure/components/commands/moderation/Slowmode.js index df124e9..a492680 100644 --- a/src/structure/components/commands/moderation/Slowmode.js +++ b/src/structure/components/commands/moderation/Slowmode.js @@ -9,8 +9,8 @@ class SlowmodeCommand extends ModerationCommand { module: 'moderation', showUsage: true, guildOnly: true, - memberPermissions: ['MANAGE_CHANNELS'], - clientPermissions: ['MANAGE_CHANNELS'], + memberPermissions: ['ManageChannels'], + clientPermissions: ['ManageChannels'], options: [ { name: 'channels', diff --git a/src/structure/components/commands/moderation/Softban.js b/src/structure/components/commands/moderation/Softban.js index a192462..6693d2f 100644 --- a/src/structure/components/commands/moderation/Softban.js +++ b/src/structure/components/commands/moderation/Softban.js @@ -8,8 +8,8 @@ class SoftbanCommand extends ModerationCommand { name: 'softban', module: 'moderation', description: 'Remove member from server and purge messages', - memberPermissions: ['KICK_MEMBERS'], - clientPermissions: ['KICK_MEMBERS'], + memberPermissions: ['KickMembers'], + clientPermissions: ['KickMembers'], options: [{ name: 'days', type: 'INTEGER', diff --git a/src/structure/components/commands/moderation/Staff.js b/src/structure/components/commands/moderation/Staff.js index 09e88dd..7290651 100644 --- a/src/structure/components/commands/moderation/Staff.js +++ b/src/structure/components/commands/moderation/Staff.js @@ -8,7 +8,7 @@ class StaffCommand extends SlashCommand { description: 'Summon staff', module: 'moderation', guildOnly: true, - clientPermissions: ['MENTION_EVERYONE', 'EMBED_LINKS'] + clientPermissions: ['MentionEveryone', 'EmbedLinks'] }); } diff --git a/src/structure/components/commands/moderation/Unban.js b/src/structure/components/commands/moderation/Unban.js index 1ed8f9b..ad25648 100644 --- a/src/structure/components/commands/moderation/Unban.js +++ b/src/structure/components/commands/moderation/Unban.js @@ -8,8 +8,8 @@ class UnbanCommand extends ModerationCommand { name: 'unban', module: 'moderation', description: 'Remove member from server and purge messages', - memberPermissions: ['BAN_MEMBERS'], - clientPermissions: ['BAN_MEMBERS'], + memberPermissions: ['BanMembers'], + clientPermissions: ['BanMembers'], options: [{ name: 'users', type: 'USERS', diff --git a/src/structure/components/commands/moderation/Unlockdown.js b/src/structure/components/commands/moderation/Unlockdown.js index 13831a5..061fe4d 100644 --- a/src/structure/components/commands/moderation/Unlockdown.js +++ b/src/structure/components/commands/moderation/Unlockdown.js @@ -16,8 +16,8 @@ class UnlockdownCommand extends ModerationCommand { }], guildOnly: true, showUsage: true, - memberPermissions: ['MANAGE_CHANNELS'], - clientPermissions: ['MANAGE_CHANNELS', 'MANAGE_ROLES'], + memberPermissions: ['ManageChannels'], + clientPermissions: ['ManageChannels', 'ManageRoles'], skipOptions: ['users', 'points', 'expiration', 'force', 'silent', 'prune'] }); diff --git a/src/structure/components/commands/moderation/Unmute.js b/src/structure/components/commands/moderation/Unmute.js index 9eff319..9ec3d56 100644 --- a/src/structure/components/commands/moderation/Unmute.js +++ b/src/structure/components/commands/moderation/Unmute.js @@ -11,8 +11,8 @@ class UnmuteCommand extends ModerationCommand { options: [], guildOnly: true, showUsage: true, - memberPermissions: ['MODERATE_MEMBERS'], - clientPermissions: ['MANAGE_ROLES', 'MODERATE_MEMBERS'], + memberPermissions: ['ModerateMembers'], + clientPermissions: ['ManageRoles', 'ModerateMembers'], skipOptions: ['points', 'expiration', 'prune', 'force'] }); } diff --git a/src/structure/components/commands/moderation/Unresolve.js b/src/structure/components/commands/moderation/Unresolve.js index 57d9d40..e1a9373 100644 --- a/src/structure/components/commands/moderation/Unresolve.js +++ b/src/structure/components/commands/moderation/Unresolve.js @@ -19,7 +19,7 @@ class ResolveCommand extends SlashCommand { name: 'unresolve', description: 'Unresolve infraction(s). Does not re-apply the infraction\'s action.', module: 'moderation', - memberPermissions: ['MANAGE_GUILD'], + memberPermissions: ['ManageGuild'], guildOnly: true, options: [{ name: 'case', diff --git a/src/structure/components/commands/moderation/Warn.js b/src/structure/components/commands/moderation/Warn.js index 28a4385..7df37d4 100644 --- a/src/structure/components/commands/moderation/Warn.js +++ b/src/structure/components/commands/moderation/Warn.js @@ -9,7 +9,7 @@ class WarnCommand extends ModerationCommand { module: 'moderation', showUsage: true, guildOnly: true, - memberPermissions: ['MODERATE_MEMBERS'], + memberPermissions: ['ModerateMembers'], options: [ { name: 'users', diff --git a/src/structure/components/commands/utility/Poll.js b/src/structure/components/commands/utility/Poll.js index 99a9a28..e75714b 100644 --- a/src/structure/components/commands/utility/Poll.js +++ b/src/structure/components/commands/utility/Poll.js @@ -57,8 +57,8 @@ class PollCommand extends SlashCommand { const questions = []; const _channel = channel?.value || invoker.channel; - const botMissing = _channel.permissionsFor(guild.me).missing(['SEND_MESSAGES', 'EMBED_LINKS']); - const userMissing = _channel.permissionsFor(member).missing(['SEND_MESSAGES']); + const botMissing = _channel.permissionsFor(guild.members.me).missing(['SendMessages', 'EmbedLinks']); + const userMissing = _channel.permissionsFor(member).missing(['SendMessages']); if (botMissing.length) return invoker.editReply({ index: 'COMMAND_POLL_BOT_PERMS', params: { missing: botMissing.join(', '), channel: _channel.id } }); if (userMissing.length) return invoker.editReply({ index: 'COMMAND_POLL_USER_PERMS', params: { missing: userMissing.join(', '), channel: _channel.id } }); @@ -68,7 +68,7 @@ class PollCommand extends SlashCommand { time: 90, editReply: true }); if (!response || !response.content) return invoker.editReply({ index: 'COMMAND_POLL_TIMEOUT' }); - if(invoker.channel.permissionsFor(guild.me).has('MANAGE_MESSAGES')) await response.delete().catch(() => null); + if(invoker.channel.permissionsFor(guild.members.me).has('ManageMessages')) await response.delete().catch(() => null); const { content } = response; if (content.toLowerCase() === 'stop') break; if (content.toLowerCase() === 'cancel') return invoker.editReply({ index: 'GENERAL_CANCELLED' }); diff --git a/src/structure/components/commands/utility/Selfrole.js b/src/structure/components/commands/utility/Selfrole.js index 84adb22..11d4c63 100644 --- a/src/structure/components/commands/utility/Selfrole.js +++ b/src/structure/components/commands/utility/Selfrole.js @@ -22,7 +22,7 @@ class SelfroleCommand extends SlashCommand { name: ['list', 'clear'], type: 'SUB_COMMAND' }], - clientPermissions: ['MANAGE_ROLES'] + clientPermissions: ['ManageRoles'] }); } @@ -34,7 +34,7 @@ class SelfroleCommand extends SlashCommand { const { guild, member } = invoker; const { selfrole } = await guild.settings(); if (!selfrole.roles.length) return { index: 'COMMAND_SELFROLE_NONE', emoji: 'failure' }; - const ownHighest = guild.me.roles.highest; + const ownHighest = guild.members.me.roles.highest; const memberRoles = member.roles.cache.map((r) => r.id); const tooHigh = roles?.value.filter((r) => r.position > ownHighest.position); diff --git a/src/structure/components/infractions/Addrole.js b/src/structure/components/infractions/Addrole.js index 91141bf..d66c691 100644 --- a/src/structure/components/infractions/Addrole.js +++ b/src/structure/components/infractions/Addrole.js @@ -53,13 +53,13 @@ class AddroleInfraction extends Infraction { const { grantable } = await this.guild.settings(); let filtered = []; - const { highest: clientHighest } = this.guild.me.roles; + const { highest: clientHighest } = this.guild.members.me.roles; filtered = this.data.roles.filter((r) => r.comparePositionTo(clientHighest) < 0); if (filtered.length === 0) { return super._fail('C_ADDROLE_ROLEHIERARCHYBOT'); } - if (grantable.enabled && !this.executorMember.permissions.has('MANAGE_ROLES')) { + if (grantable.enabled && !this.executorMember.permissions.has('ManageRoles')) { //Only use grantable roles filtered = this.data.roles.filter((r) => grantable.roles.includes(r.id)); if (filtered.length === 0) { diff --git a/src/structure/components/infractions/Lockdown.js b/src/structure/components/infractions/Lockdown.js index 126ad97..3603fee 100644 --- a/src/structure/components/infractions/Lockdown.js +++ b/src/structure/components/infractions/Lockdown.js @@ -1,6 +1,7 @@ +const { OverwriteType } = require('discord.js'); const { Infraction } = require('../../interfaces/'); -const allowedPermissions = ['MANAGE_MESSAGES', 'MANAGE_CHANNELS']; +const allowedPermissions = ['ManageMessages', 'ManageChannels']; class LockdownInfraction extends Infraction { @@ -41,7 +42,7 @@ class LockdownInfraction extends Infraction { const overwrites = [...permissions.cache.values()]; const newOverwrites = []; for (const permission of overwrites) { - const roleOrMember = permission.type === 'role' ? + const roleOrMember = permission.type === OverwriteType.Role ? await this.guild.roles.fetch(permission.id) : await this.guild.members.fetch(permission.id); if (roleOrMember && roleOrMember.permissions.has(allowedPermissions)) { @@ -53,27 +54,27 @@ class LockdownInfraction extends Infraction { this.data.oldPermissions[permission.id] = { type: permission.type, permissions: { - SEND_MESSAGES: null, - ADD_REACTIONS: null + SendMessages: null, + AddReactions: null } }; const allowed = permission.allow.toArray(); const denied = permission.deny.toArray(); - if (permission.allow.has('SEND_MESSAGES')) { - this.data.oldPermissions[permission.id].permissions.SEND_MESSAGES = true; - allowed.splice(allowed.indexOf('SEND_MESSAGES'), 1); - denied.push('SEND_MESSAGES'); - } else if (permission.deny.has('SEND_MESSAGES')) this.data.oldPermissions[permission.id].permissions.SEND_MESSAGES = false; - else denied.push('SEND_MESSAGES'); + if (permission.allow.has('SendMessages')) { + this.data.oldPermissions[permission.id].permissions.SendMessages = true; + allowed.splice(allowed.indexOf('SendMessages'), 1); + denied.push('SendMessages'); + } else if (permission.deny.has('SendMessages')) this.data.oldPermissions[permission.id].permissions.SendMessages = false; + else denied.push('SendMessages'); - if (permission.allow.has('ADD_REACTIONS')) { - this.data.oldPermissions[permission.id].permissions.ADD_REACTIONS = true; - allowed.splice(allowed.indexOf('ADD_REACTIONS'), 1); - denied.push('ADD_REACTIONS'); - } else if (permission.deny.has('ADD_REACTIONS')) this.data.oldPermissions[permission.id].permissions.ADD_REACTIONS = false; - else denied.push('ADD_REACTIONS'); + if (permission.allow.has('AddReactions')) { + this.data.oldPermissions[permission.id].permissions.AddReactions = true; + allowed.splice(allowed.indexOf('AddReactions'), 1); + denied.push('AddReactions'); + } else if (permission.deny.has('AddReactions')) this.data.oldPermissions[permission.id].permissions.AddReactions = false; + else denied.push('AddReactions'); newOverwrites.push({ @@ -84,8 +85,8 @@ class LockdownInfraction extends Infraction { }); // try { // await permissions.edit(permission.id, { - // SEND_MESSAGES: false, - // ADD_REACTIONS: false + // SendMessages: false, + // AddReactions: false // }, { type: permission.type === 'role' ? 0 : 1, reason: this._reason }); // } catch (error) { // this._fail(); @@ -96,38 +97,38 @@ class LockdownInfraction extends Infraction { // The everyone role won't be edited unless it has any changes, so ensure it has been processed if (!this.data.oldPermissions[everyoneRole.id]) { this.data.oldPermissions[everyoneRole.id] = { - type: 'role', + type: OverwriteType.Role, permissions: { - SEND_MESSAGES: null, - ADD_REACTIONS: null + SendMessages: null, + AddReactions: null } }; newOverwrites.push({ id: everyoneRole.id, - deny: ['SEND_MESSAGES', 'ADD_REACTIONS'], - type: 'role' + deny: ['SendMessages', 'AddReactions'], + type: OverwriteType.Role }); // await permissions.create(permissions.id, { - // SEND_MESSAGES: false, - // ADD_REACTIONS: false + // SendMessages: false, + // AddReactions: false // }, { type: 0, reason: this._reason }); } // console.log(this.data); // Ensures the bot can still send messages // await permissions.edit(this.client.user.id, { - // SEND_MESSAGES: true, - // ADD_REACTIONS: true + // SendMessages: true, + // AddReactions: true // }, { type: 1 }); const index = newOverwrites.findIndex((entry) => entry.id === this.client.user.id); if (index >= 0) { - if (!newOverwrites[index].allow.has('SEND_MESSAGES')) - newOverwrites[index].allow.add('SEND_MESSAGES'); - if (newOverwrites[index].deny.has('SEND_MESSAGES')) - newOverwrites[index].deny.remove('SEND_MESSAGES'); + if (!newOverwrites[index].allow.has('SendMessages')) + newOverwrites[index].allow.add('SendMessages'); + if (newOverwrites[index].deny.has('SendMessages')) + newOverwrites[index].deny.remove('SendMessages'); } else newOverwrites.push({ id: this.client.user.id, - allow: ['SEND_MESSAGES', 'MANAGE_ROLES'] + allow: ['SendMessages', 'ManageRoles'] }); await permissions.set(newOverwrites, this._reason); diff --git a/src/structure/components/infractions/Mute.js b/src/structure/components/infractions/Mute.js index 22abb15..3756750 100644 --- a/src/structure/components/infractions/Mute.js +++ b/src/structure/components/infractions/Mute.js @@ -60,12 +60,12 @@ class MuteInfraction extends Infraction { break; case 1: removed = this.member.roles.cache.filter((r) => !r.managed && - r.comparePositionTo(this.guild.me.roles.highest) < 0 && + r.comparePositionTo(this.guild.members.me.roles.highest) < 0 && r.id !== this.guild.id); try { this.member.roles.set([ ...this.member.roles.cache.filter((r) => r.managed || - r.comparePositionTo(this.guild.me.roles.highest) > 0 || + r.comparePositionTo(this.guild.members.me.roles.highest) > 0 || r.id === this.guild.id).values(), role ], this._reason); @@ -76,11 +76,11 @@ class MuteInfraction extends Infraction { break; case 2: removed = this.member.roles.cache.filter((r) => !r.managed && - r.comparePositionTo(this.guild.me.roles.highest) < 0 && + r.comparePositionTo(this.guild.members.me.roles.highest) < 0 && r.id !== this.guild.id); try { this.member.roles.set(this.member.roles.cache.filter((r) => r.managed || - r.comparePositionTo(this.guild.me.roles.highest) > 0 || + r.comparePositionTo(this.guild.members.me.roles.highest) > 0 || r.id === this.guild.id), this._reason); } catch (error) { this.client.logger.error(`Mute infraction failed to calculate removeable roles, might want to check this out.\n${error.stack || error}`); @@ -135,9 +135,9 @@ class MuteInfraction extends Infraction { } } if (settings.mute.type === 3) { - if (this.guild.me.permissions.missing('MODERATE_MEMBERS').length) return this._fail('COMMAND_MUTE_MISSING_MODERATE_PERM', true); + if (this.guild.members.me.permissions.missing('ModerateMembers').length) return this._fail('COMMAND_MUTE_MISSING_MODERATE_PERM', true); // if (!this.duration && !settings.mute.default) - } else if (this.guild.me.permissions.missing('MANAGE_ROLES').length) return this._fail('COMMAND_MUTE_MISSING_MANAGEROLE_PERM'); + } else if (this.guild.members.me.permissions.missing('ManageRoles').length) return this._fail('COMMAND_MUTE_MISSING_MANAGEROLE_PERM'); return super._verify(); diff --git a/src/structure/components/infractions/Nickname.js b/src/structure/components/infractions/Nickname.js index ede8c26..55575ba 100644 --- a/src/structure/components/infractions/Nickname.js +++ b/src/structure/components/infractions/Nickname.js @@ -82,7 +82,7 @@ class NicknameInfraction extends Infraction { async verify() { const { highest } = this.member.roles; - if (highest.comparePositionTo(this.guild.me.roles.highest) > 0) { + if (highest.comparePositionTo(this.guild.members.me.roles.highest) > 0) { return this._fail('C_NICKNAME_MISSINGPERMISSIONS'); } diff --git a/src/structure/components/infractions/Removerole.js b/src/structure/components/infractions/Removerole.js index 4ee85b1..17edc9f 100644 --- a/src/structure/components/infractions/Removerole.js +++ b/src/structure/components/infractions/Removerole.js @@ -53,13 +53,13 @@ class RemoveroleInfraction extends Infraction { const { grantable } = await this.guild.settings(); let filtered = []; - const { highest: clientHighest } = this.guild.me.roles; + const { highest: clientHighest } = this.guild.members.me.roles; filtered = this.data.roles.filter((r) => r.comparePositionTo(clientHighest) < 0); if (filtered.length === 0) { return super._fail('C_REMOVEROLE_ROLEHIERARCHYBOT'); } - if (grantable.enabled && !this.executorMember.permissions.has('MANAGE_ROLES')) { + if (grantable.enabled && !this.executorMember.permissions.has('ManageRoles')) { //Only use grantable roles filtered = this.data.roles.filter((r) => grantable.roles.includes(r.id)); if (filtered.length === 0) { diff --git a/src/structure/components/infractions/Unlockdown.js b/src/structure/components/infractions/Unlockdown.js index c0482ff..b13c307 100644 --- a/src/structure/components/infractions/Unlockdown.js +++ b/src/structure/components/infractions/Unlockdown.js @@ -58,16 +58,16 @@ class UnlockdownInfraction extends Infraction { const denied = permission.deny.toArray(); const old = oldPerms[permission.id].permissions; - if (old.SEND_MESSAGES === null) denied.splice(denied.indexOf('SEND_MESSAGES'), 1); - if (old.ADD_REACTIONS === null) denied.splice(denied.indexOf('ADD_REACTIONS'), 1); + if (old.SendMessages === null) denied.splice(denied.indexOf('SendMessages'), 1); + if (old.AddReactions === null) denied.splice(denied.indexOf('AddReactions'), 1); - if (old.SEND_MESSAGES) { - denied.splice(denied.indexOf('SEND_MESSAGES'), 1); - allowed.push('SEND_MESSAGES'); + if (old.SendMessages) { + denied.splice(denied.indexOf('SendMessages'), 1); + allowed.push('SendMessages'); } - if (old.ADD_REACTIONS) { - denied.splice(denied.indexOf('ADD_REACTIONS'), 1); - allowed.push('ADD_REACTIONS'); + if (old.AddReactions) { + denied.splice(denied.indexOf('AddReactions'), 1); + allowed.push('AddReactions'); } newOverwrites.push({ diff --git a/src/structure/components/inhibitors/ClientPermissions.js b/src/structure/components/inhibitors/ClientPermissions.js index c64ab73..00fe8ef 100644 --- a/src/structure/components/inhibitors/ClientPermissions.js +++ b/src/structure/components/inhibitors/ClientPermissions.js @@ -13,7 +13,7 @@ class ClientPermissions extends Inhibitor { async execute(invoker, command) { - const missing = invoker.channel.permissionsFor(invoker.guild.me).missing(command.clientPermissions); + const missing = invoker.channel.permissionsFor(invoker.guild.members.me).missing(command.clientPermissions); if (missing.length) return super._fail({ error: true, missing: missing.join(', '), silent: true }); return super._succeed(); diff --git a/src/structure/components/inhibitors/Permissions.js b/src/structure/components/inhibitors/Permissions.js index 074f8b3..0a8b762 100644 --- a/src/structure/components/inhibitors/Permissions.js +++ b/src/structure/components/inhibitors/Permissions.js @@ -31,7 +31,7 @@ class Permissions extends Inhibitor { if (missing.length === permissions.length && permissions.length > 0) return super._fail({ missing: missing.join(', ') }); } else if (type === 'grant' && permissions.length) { - if (safeCommands.includes(command.resolveable) && memberPerms.has(['MANAGE_GUILD'])) + if (safeCommands.includes(command.resolveable) && memberPerms.has(['ManageGuild'])) return super._succeed(); missing = await this._checkGrants(invoker, command.resolveable); } else if (type === 'both') { diff --git a/src/structure/components/observers/AuditLog.js b/src/structure/components/observers/AuditLog.js index ece7ce5..ab65a58 100644 --- a/src/structure/components/observers/AuditLog.js +++ b/src/structure/components/observers/AuditLog.js @@ -147,7 +147,7 @@ class AuditLogObserver extends Observer { } async _fetchFirstEntry(guild, user, type, subtype = null) { - if (!guild.me.permissions.has('VIEW_AUDIT_LOG')) return null; + if (!guild.members.me.permissions.has('ViewAuditLog')) return null; const audit = await guild.fetchAuditLogs({ limit: 1, type }); if (audit.entries.size === 0) return null; diff --git a/src/structure/components/observers/Automoderation.js b/src/structure/components/observers/Automoderation.js index 361a1f1..87548a8 100644 --- a/src/structure/components/observers/Automoderation.js +++ b/src/structure/components/observers/Automoderation.js @@ -19,12 +19,12 @@ const CONSTANTS = { BAN: 'DANGER', }, Permissions: { - WARN: 'KICK_MEMBERS', - MUTE: 'MODERATE_MEMBERS', - KICK: 'KICK_MEMBERS', - SOFTBAN: 'KICK_MEMBERS', - BAN: 'BAN_MEMBERS', - DELETE: 'MANAGE_MESSAGES' + WARN: 'KickMembers', + MUTE: 'ModerateMembers', + KICK: 'KickMembers', + SOFTBAN: 'KickMembers', + BAN: 'BanMembers', + DELETE: 'ManageMessages' } }; @@ -99,7 +99,7 @@ module.exports = class AutoModeration extends Observer { const result = await this.client.moderationManager.handleAutomod(InfractionClass, member, { wrapper, channel, - executor: moderator || wrapper.guild.me, + executor: moderator || wrapper.guild.members.me, reason, duration: action.duration ? action.duration * 1000 : null, points: action.points, @@ -132,7 +132,7 @@ module.exports = class AutoModeration extends Observer { if (!enabled || roles.some((r) => bypass.includes(r)) || ignore.includes(channel.id)) return; - const missing = channel.permissionsFor(guild.me).missing('MANAGE_MESSAGES'); + const missing = channel.permissionsFor(guild.members.me).missing('ManageMessages'); if (missing.length) { this.client.emit('filterMissingPermissions', { channel, guild: wrapper, filter: 'word', permissions: missing }); return; @@ -372,7 +372,7 @@ module.exports = class AutoModeration extends Observer { ); if (error) { - const missing = moderator.permissions.missing('MANAGE_MESSAGES'); + const missing = moderator.permissions.missing('ManageMessages'); if (args.missing !== 'command:delete') return fail(inhibitor.index, { command: actionType, missing: args.missing }); else if (missing.length) return fail(inhibitor.index, { missing: missing.join(', ') }); } @@ -431,7 +431,7 @@ module.exports = class AutoModeration extends Observer { if (roles.some((r) => bypass.includes(r)) || ignore.includes(channel.id)) return; - const missing = channel.permissionsFor(guild.me).missing('MANAGE_MESSAGES'); + const missing = channel.permissionsFor(guild.members.me).missing('ManageMessages'); if (missing.length) { this.client.emit('filterMissingPermissions', { channel, guild: wrapper, filter: 'link', permissions: missing }); return; @@ -555,7 +555,7 @@ module.exports = class AutoModeration extends Observer { if (roles.some((r) => bypass.includes(r)) || ignore.includes(channel.id)) return; - const missing = channel.permissionsFor(guild.me).missing('MANAGE_MESSAGES'); + const missing = channel.permissionsFor(guild.members.me).missing('ManageMessages'); if (missing.length) { this.client.emit('filterMissingPermissions', { channel, guild: wrapper, filter: 'invite', permissions: missing }); return; @@ -612,7 +612,7 @@ module.exports = class AutoModeration extends Observer { if (!enabled || roles.some((r) => bypass.includes(r)) || ignore.includes(channel.id)) return; - const missing = channel.permissionsFor(guild.me).missing('MANAGE_MESSAGES'); + const missing = channel.permissionsFor(guild.members.me).missing('ManageMessages'); if (missing.length) { this.client.emit('filterMissingPermissions', { channel, guild: wrapper, filter: 'mention', permissions: missing }); return; diff --git a/src/structure/components/observers/CommandHandler.js b/src/structure/components/observers/CommandHandler.js index 2207d79..cc872d2 100644 --- a/src/structure/components/observers/CommandHandler.js +++ b/src/structure/components/observers/CommandHandler.js @@ -1,4 +1,4 @@ -const { MessageEmbed, Message } = require('discord.js'); +const { EmbedBuilder, Message } = require('discord.js'); const { Util } = require('../../../utilities'); const { InvokerWrapper, MessageWrapper } = require('../../client/wrappers'); const { Observer, CommandError } = require('../../interfaces/'); @@ -46,7 +46,7 @@ class CommandHandler extends Observer { const silent = inhibitors.filter((i) => i.inhibitor.silent); const nonsilent = inhibitors.filter((i) => !i.inhibitor.silent); if (silent.length && silent.some((i) => i.inhibitor.id === 'channelIgnore') - || nonsilent.length && nonsilent.some((i) => i.args.missing.includes('SEND_MESSAGES')) + || nonsilent.length && nonsilent.some((i) => i.args.missing.includes('SendMessages')) || silent.length && !nonsilent.length) return; if (inhibitors.length) return this._generateError(invoker, { type: 'inhibitor', ...inhibitors[0] }).catch(this.logger.error); @@ -166,7 +166,7 @@ class CommandHandler extends Observer { if (response instanceof Message || response === null) return; if (response) { - if (response instanceof MessageEmbed) return invoker.reply({ embeds: [response] }); + if (response instanceof EmbedBuilder) return invoker.reply({ embeds: [response] }); else if (typeof response === 'string') return invoker.reply({ content: response }); else if (typeof response === 'object') return invoker.reply(response); } diff --git a/src/structure/components/observers/GuildLogging.js b/src/structure/components/observers/GuildLogging.js index f948f20..04b7dae 100644 --- a/src/structure/components/observers/GuildLogging.js +++ b/src/structure/components/observers/GuildLogging.js @@ -1,12 +1,12 @@ /* eslint-disable no-labels */ -const { MessageAttachment, WebhookClient } = require('discord.js'); +const { WebhookClient, AttachmentBuilder } = require('discord.js'); const { stripIndents } = require('common-tags'); const moment = require('moment'); const { inspect } = require('util'); const { Observer } = require('../../interfaces/'); -const { Util } = require('../../../utilities'); const { Constants: { EmbedLimits } } = require('../../../constants'); +const { Util } = require('../../../utilities'); const CONSTANTS = { COLORS: { @@ -97,7 +97,7 @@ class GuildLogger extends Observer { if (!logChannel) return; const owner = await guild.resolveUser(ownerId); - const missing = logChannel.permissionsFor(guild.me).missing(['VIEW_CHANNEL', 'EMBED_LINKS', 'SEND_MESSAGES']); + const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); if (missing.length) return this.client.emit('logError', { guild, logger: 'threadLogger', reason: 'MSGLOG_NO_PERMS', params: { missing: missing.join(', ') } }); @@ -108,7 +108,7 @@ class GuildLogger extends Observer { } let actor = null; - const auditLogPerm = guild.me.permissions.has('VIEW_AUDIT_LOG'); + const auditLogPerm = guild.members.me.permissions.has('ViewAuditLog'); if (type === 'CREATE') actor = owner; else if (type === 'DELETE' && auditLogPerm) { const auditLogs = await guild.fetchAuditLogs({ type: 'THREAD_DELETE', limit: 1 }); @@ -163,7 +163,7 @@ class GuildLogger extends Observer { const logChannel = await wrapper.resolveChannel(messageLog.channel); if (!logChannel) return undefined; - const missing = logChannel.permissionsFor(wrapper.me).missing(['VIEW_CHANNEL', 'EMBED_LINKS', 'SEND_MESSAGES', 'MANAGE_WEBHOOKS']); + const missing = logChannel.permissionsFor(wrapper.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages', 'ManageWebhooks']); if (missing.length) return this.client.emit('logError', { guild: wrapper, logger: 'messageLogger', reason: 'MSGLOG_NO_PERMS', params: { missing: missing.join(', ') } }); @@ -251,7 +251,9 @@ class GuildLogger extends Observer { if (attachmentData) { // Mongo does some weird serialisation of buffer data, so to access the actual buffer, you have to go 1 level deeper attachmentData.buffer = attachmentData.buffer.buffer; //Buffer.from(attachmentData.buffer, 'base64'); - const messageAttachment = new MessageAttachment(attachmentData.buffer, attachment.name, { size: attachment.size }); + const messageAttachment = new AttachmentBuilder(attachmentData.buffer, { + name: attachment.name, size: attachment.size + }); if (messageAttachment.size < CONSTANTS.IMAGES.UPLOAD_LIMIT[message.guild.premiumTier] * CONSTANTS.IMAGES.MB_DIVIDER) { @@ -338,7 +340,7 @@ class GuildLogger extends Observer { const { ignore, bypass } = chatlogs; if (ignore.includes(channel.id)) return; - const missing = logChannel.permissionsFor(guild.me).missing(['VIEW_CHANNEL', 'EMBED_LINKS', 'SEND_MESSAGES', 'MANAGE_WEBHOOKS']); + const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages', 'ManageWebhooks']); if (missing.length) return this.client.emit('logError', { guild: wrapper, logger: 'messageLogger', reason: 'MSGLOG_NO_PERMS', params: { missing: missing.join(', ') } }); @@ -396,7 +398,9 @@ class GuildLogger extends Observer { if (attachment.size > 8 * CONSTANTS.IMAGES.MB_DIVIDER) continue; //(attachment.size > CONSTANTS.IMAGES.UPLOAD_LIMIT[message.guild.premiumTier] * CONSTANTS.IMAGES.MB_DIVIDER) attachmentData.buffer = attachmentData.buffer.buffer; - const messageAttachment = new MessageAttachment(attachmentData.buffer, attachment.name, { size: attachment.size }); + const messageAttachment = new AttachmentBuilder(attachmentData.buffer, { + name: attachment.name, size: attachment.size + }); files.push(messageAttachment); } @@ -523,7 +527,7 @@ class GuildLogger extends Observer { const logChannel = await wrapper.resolveChannel(_channel); if (!logChannel) return undefined; - const missing = logChannel.permissionsFor(guild.me).missing(['VIEW_CHANNEL', 'EMBED_LINKS', 'SEND_MESSAGES', 'MANAGE_WEBHOOKS']); + const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages', 'ManageWebhooks']); if (missing.length) return this.client.emit('logError', { guild: wrapper, logger: 'messageLogger', reason: 'MSGLOG_NO_PERMS', params: { missing: missing.join(', ') } }); @@ -650,7 +654,7 @@ class GuildLogger extends Observer { const logChannel = await wrapper.resolveChannel(setting.channel); if (!logChannel) return; - const missing = logChannel.permissionsFor(guild.me).missing(['VIEW_CHANNEL', 'EMBED_LINKS', 'SEND_MESSAGES']); + const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); if (missing.length) return this.client.emit('logError', { guild: wrapper, logger: 'vcLogger', reason: 'VCLOG_NO_PERMS', params: { missing: missing.join(', ') } }); @@ -694,7 +698,7 @@ class GuildLogger extends Observer { const logChannel = await wrapper.resolveChannel(setting.channel); if (!logChannel) return; - const missing = logChannel.permissionsFor(guild.me).missing(['VIEW_CHANNEL', 'EMBED_LINKS', 'SEND_MESSAGES']); + const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); if (missing.length) return this.client.emit('logError', { guild: wrapper, logger: 'vcLogger', reason: 'MEMBERLOG_NO_PERMS', params: { missing: missing.join(', ') } }); @@ -714,7 +718,7 @@ class GuildLogger extends Observer { const logChannel = await wrapper.resolveChannel(setting.channel); if (!logChannel) return; - const missing = logChannel.permissionsFor(guild.me).missing(['VIEW_CHANNEL', 'EMBED_LINKS', 'SEND_MESSAGES']); + const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); if (missing.length) return this.client.emit('logError', { guild: wrapper, logger: 'vcLogger', reason: 'MEMBERLOG_NO_PERMS', params: { missing: missing.join(', ') } }); @@ -736,7 +740,7 @@ class GuildLogger extends Observer { const logChannel = await wrapper.resolveChannel(setting.channel); if (!logChannel) return; - const missing = logChannel.permissionsFor(guild.me).missing(['VIEW_CHANNEL', 'EMBED_LINKS', 'SEND_MESSAGES']); + const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); if (missing.length) return this.client.emit('logError', { guild: wrapper, logger: 'vcLogger', reason: 'NICKLOG_NO_PERMS', params: { missing: missing.join(', ') } }); diff --git a/src/structure/components/observers/UtilityHook.js b/src/structure/components/observers/UtilityHook.js index db620e3..752481b 100644 --- a/src/structure/components/observers/UtilityHook.js +++ b/src/structure/components/observers/UtilityHook.js @@ -51,7 +51,7 @@ class UtilityHook extends Observer { const { guildWrapper: guild } = member; const settings = await guild.settings(); const setting = settings.mute; - if (!guild.me.permissions.has('MANAGE_ROLES')) return; + if (!guild.members.me.permissions.has('ManageRoles')) return; const infraction = await this.client.storageManager.mongodb.infractions.findOne({ duration: { $gt: 0 }, @@ -100,7 +100,7 @@ class UtilityHook extends Observer { const settings = await guild.settings(); const setting = settings.stickyrole; if (!setting.roles.length || guild.premium < 1) return; - if (!guild.me.permissions.has('MANAGE_ROLES')) return; + if (!guild.members.me.permissions.has('ManageRoles')) return; const data = await this.client.storageManager.mongodb.role_cache.findOne({ guild: guild.id, member: member.id }); if (!data) return; @@ -115,7 +115,7 @@ class UtilityHook extends Observer { const settings = await guild.settings(); const setting = settings.autorole; if (!setting.enabled) return; - if (!guild.me.permissions.has('MANAGE_ROLES')) return; + if (!guild.members.me.permissions.has('ManageRoles')) return; const _roles = await guild.resolveRoles(setting.roles); const roles = _roles.map((r) => r.id); @@ -153,7 +153,7 @@ class UtilityHook extends Observer { const { guild } = invite; if (!guild) return; - if (!guild.me.permissions.has('MANAGE_GUILD')) return; + if (!guild.members.me.permissions.has('ManageGuild')) return; if (!guild.invites) guild.invites = await guild.fetchInvites(); guild.invites.set(invite.code, invite); @@ -163,7 +163,7 @@ class UtilityHook extends Observer { const { guild } = invite; if (!guild) return; - if (!guild.me.permissions.has('MANAGE_GUILD')) return; + if (!guild.members.me.permissions.has('ManageGuild')) return; if (!guild.invites) guild.invites = await guild.fetchInvites(); guild.invites.delete(invite.code); @@ -203,7 +203,7 @@ class UtilityHook extends Observer { !selfrole.channel || selfrole.channel !== channel.id || !selfrole.roles.length) return; - const missing = guild.me.permissions.missing(['MANAGE_ROLES']); + const missing = guild.members.me.permissions.missing(['ManageRoles']); if (missing.length) return this.client.emit('utilityError', { guild, utility: 'selfrole', reason: 'UTILITY_SELFROLE_PERMS', params: { missing: missing.join(', ') } }); diff --git a/src/structure/components/settings/logging/Errors.js b/src/structure/components/settings/logging/Errors.js index 2b9e2ca..9952286 100644 --- a/src/structure/components/settings/logging/Errors.js +++ b/src/structure/components/settings/logging/Errors.js @@ -12,7 +12,7 @@ class MessageLog extends Setting { module: 'logging', description: 'Have the bot send error messages in the server for configuration errors', display: 'Error Logging', - clientPermissions: ['MANAGE_WEBHOOKS'], + clientPermissions: ['ManageWebhooks'], default: { channel: null, types: [] @@ -46,8 +46,8 @@ class MessageLog extends Setting { if (opts.channel) { const channel = opts.channel.value; - const perms = channel.permissionsFor(guild.me); - const missingPerms = perms.missing(['SEND_MESSAGES', 'VIEW_CHANNEL', 'EMBED_LINKS']); + const perms = channel.permissionsFor(guild.members.me); + const missingPerms = perms.missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); if (missingPerms.length) return { error: true, index: 'ERR_CHANNEL_PERMS', diff --git a/src/structure/components/settings/logging/Messages.js b/src/structure/components/settings/logging/Messages.js index f4f4f0e..930c904 100644 --- a/src/structure/components/settings/logging/Messages.js +++ b/src/structure/components/settings/logging/Messages.js @@ -10,7 +10,7 @@ class MessageLog extends Setting { module: 'logging', description: 'Configure where messages are logged', display: 'Message Logging', - clientPermissions: ['MANAGE_WEBHOOKS'], + clientPermissions: ['ManageWebhooks'], default: { channel: null, ignore: [], @@ -82,8 +82,8 @@ class MessageLog extends Setting { if (opts.channel) { const channel = opts.channel.value; - const perms = channel.permissionsFor(guild.me); - const missingPerms = perms.missing(['SEND_MESSAGES', 'VIEW_CHANNEL', 'MANAGE_WEBHOOKS', 'EMBED_LINKS']); + const perms = channel.permissionsFor(guild.members.me); + const missingPerms = perms.missing(['ViewChannel', 'EmbedLinks', 'SendMessages', 'ManageWebhooks']); if (missingPerms.length) return { error: true, index: 'ERR_CHANNEL_PERMS', diff --git a/src/structure/components/settings/moderation/Mute.js b/src/structure/components/settings/moderation/Mute.js index 67137a7..8565252 100644 --- a/src/structure/components/settings/moderation/Mute.js +++ b/src/structure/components/settings/moderation/Mute.js @@ -133,7 +133,7 @@ class MuteSetting extends Setting { const permissionIssues = issues.filter((i) => i.type === 'permission'); if (textIssues.length) embed.fields.push(addField(textIssues, 'text')); if (voiceIssues.length) embed.fields.push(addField(voiceIssues, 'voice')); - if (permissionIssues.length) embed.fields.push({ name: 'Missing `MANAGE_ROLES`', value: permissionIssues.map((i) => invoker.guild.format('SETTING_MUTE_MISSING_CHANNEL_PERMS', i)).join('\n') }); + if (permissionIssues.length) embed.fields.push({ name: 'Missing `ManageRoles`', value: permissionIssues.map((i) => invoker.guild.format('SETTING_MUTE_MISSING_CHANNEL_PERMS', i)).join('\n') }); response.embeds = [embed]; updated.push('role'); @@ -186,7 +186,7 @@ class MuteSetting extends Setting { return role; }; - const hasPermission = guild.me.permissions.has('MANAGE_ROLES'); + const hasPermission = guild.members.me.permissions.has('ManageRoles'); if (!hasPermission) return { index: 'SETTING_MUTE_ROLEMISSINGPERMISSION', error: true @@ -250,14 +250,14 @@ class MuteSetting extends Setting { for (const channel of channels.values()) { - if (!channel.permissionsFor(guild.me).has('MANAGE_ROLES')) { + if (!channel.permissionsFor(guild.members.me).has('ManageRoles')) { issues.push({ type: 'permission', channel: channel.name }); continue; } const configuration = channel.type === 'GUILD_TEXT' - ? { permissions: { SEND_MESSAGES: false, ADD_REACTIONS: false }, bitwise: 0x800n } - : { permissions: { CONNECT: false, SEND_MESSAGES: false, ADD_REACTIONS: false }, bitwise: 0x100000n }; + ? { permissions: { SendMessages: false, AddReactions: false }, bitwise: 0x800n } + : { permissions: { CONNECT: false, SendMessages: false, AddReactions: false }, bitwise: 0x100000n }; try { await channel.permissionOverwrites.create(role, configuration.permissions, { reason: super.reason(user) }); diff --git a/src/structure/interfaces/Setting.js b/src/structure/interfaces/Setting.js index 1c0641e..768568e 100644 --- a/src/structure/interfaces/Setting.js +++ b/src/structure/interfaces/Setting.js @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ // eslint-disable-next-line no-unused-vars -const { Base, Guild, InteractionCollector, MessageEmbed } = require("discord.js"); +const { Base, Guild, InteractionCollector, EmbedBuilder } = require("discord.js"); const { Util } = require("../../utilities"); const Component = require("./Component.js"); @@ -144,7 +144,7 @@ class Setting extends Component { }); } - return new MessageEmbed({ + return new EmbedBuilder({ author: { name: `${this.display} [module:${this.module.name}]` }, @@ -208,7 +208,7 @@ class Setting extends Component { if (!response) return { error: true, message: invoker.format('ERR_TIMEOUT') }; const content = response.content.toLowerCase(); - if(invoker.channel.permissionsFor(invoker.guild.me).has('MANAGE_MESSAGES')) + if(invoker.channel.permissionsFor(invoker.guild.members.me).has('ManageMessages')) await response.delete().catch(() => null); if (['cancel', 'abort', 'exit'].includes(content)) return { error: true, diff --git a/src/structure/interfaces/commands/Command.js b/src/structure/interfaces/commands/Command.js index c4ee127..681f54d 100644 --- a/src/structure/interfaces/commands/Command.js +++ b/src/structure/interfaces/commands/Command.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); // eslint-disable-next-line no-unused-vars // const { DiscordClient } = require('../../DiscordClient.js'); @@ -38,9 +38,9 @@ class Command extends Component { this.archivable = options.archivable === undefined ? true : Boolean(options.archivable); this.slash = Boolean(options.slash); - - this.clientPermissions = [...new Set(['SEND_MESSAGES', ...options.clientPermissions || []])]; - this.memberPermissions = options.memberPermissions || []; + // Convers permissions to PascalCase from snake case bc for some reason d.js decided it was a good change + this.clientPermissions = [...new Set(['SendMessages', ...options.clientPermissions || []])]; //.map(Util.pascalConverter); + this.memberPermissions = options.memberPermissions || []; //.map(Util.pascalConverter); this._invokes = { success: 0, @@ -131,7 +131,7 @@ class Command extends Component { }); } - return new MessageEmbed({ + return new EmbedBuilder({ author: { name: `${this.name} [module:${this.module.name}]` }, diff --git a/src/structure/interfaces/commands/SettingsCommand.js b/src/structure/interfaces/commands/SettingsCommand.js index c6fcd2e..7fdb207 100644 --- a/src/structure/interfaces/commands/SettingsCommand.js +++ b/src/structure/interfaces/commands/SettingsCommand.js @@ -10,7 +10,7 @@ class SettingsCommand extends SlashCommand { super(client, { ...options, guildOnly: true, - memberPermissions: ['MANAGE_GUILD'] + memberPermissions: ['ManageGuild'] }); /* @@ -89,7 +89,7 @@ class SettingsCommand extends SlashCommand { if (!setting) return invoker.reply('Something went wrong, could not find setting'); if (setting.clientPermissions.length) { - const missing = guild.me.permissions.missing(setting.clientPermissions); + const missing = guild.members.me.permissions.missing(setting.clientPermissions); if (missing.length) return invoker.reply({ emoji: 'failure', index: 'SETTING_MISSING_CLIENTPERMISSIONS', diff --git a/src/structure/interfaces/commands/SlashCommand.js b/src/structure/interfaces/commands/SlashCommand.js index 6b39bfd..573f0e3 100644 --- a/src/structure/interfaces/commands/SlashCommand.js +++ b/src/structure/interfaces/commands/SlashCommand.js @@ -1,6 +1,6 @@ const Command = require('./Command.js'); const { Commands: CommandsConstant } = require('../../../constants/'); -const { Permissions } = require('discord.js'); +const { PermissionsBitField } = require('discord.js'); // eslint-disable-next-line no-unused-vars // const { DiscordClient } = require('../../DiscordClient.js'); @@ -49,7 +49,9 @@ class SlashCommand extends Command { // eslint-disable-next-line camelcase dm_permission: !this.guildOnly, // eslint-disable-next-line camelcase - default_member_permissions: this.memberPermissions.length ? new Permissions(this.memberPermissions).bitfield.toString() : null + default_member_permissions: this.memberPermissions.length ? + // This may need to be changed in the future, for now too lazy to go through all the commands changing the resolveables -- changed in d.js v14 + new PermissionsBitField(this.memberPermissions).bitfield.toString() : null }; } diff --git a/src/utilities/SettingsMigrator.js b/src/utilities/SettingsMigrator.js index fd60f55..1bbdaa9 100644 --- a/src/utilities/SettingsMigrator.js +++ b/src/utilities/SettingsMigrator.js @@ -165,7 +165,7 @@ class SettingsMigrator { get permissiongResolveables() { return { 'module:moderation': ['mod', 'moderation', 'moderator', 'category:moderation'], - 'module:administration': ['admin', 'administrator', 'administration', 'category:administration'] + 'module:administration': ['admin', 'Administrator', 'administration', 'category:administration'] }; } diff --git a/src/utilities/Util.js b/src/utilities/Util.js index 102d72b..f29b4d6 100644 --- a/src/utilities/Util.js +++ b/src/utilities/Util.js @@ -3,7 +3,7 @@ const humaniseDuration = require('humanize-duration'); const path = require('path'); const fs = require('fs'); const fetch = require('node-fetch'); -const { Util: DiscordUtil } = require('discord.js'); +const { escapeMarkdown } = require('discord.js'); const Constants = { QuotePairs: { @@ -52,6 +52,10 @@ class Util { return `${first}${str.substring(1)}`; } + static pascalConverter(item) { + return item.split('_').map((x) => Util.capitalise(x.toLowerCase())).join(''); + } + static paginate(items, page = 1, pageLength = 10) { const maxPage = Math.ceil(items.length / pageLength); if (page < 1) page = 1; @@ -116,7 +120,7 @@ class Util { static escapeMarkdown(text, options) { if (typeof text !== 'string') return text; - return DiscordUtil.escapeMarkdown(text, options); + return escapeMarkdown(text, options); } /** diff --git a/yarn.lock b/yarn.lock index 9a7c405..b103efe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -339,14 +339,13 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@discordjs/builders@^0.14.0": - version "0.14.0" - resolved "https://registry.yarnpkg.com/@discordjs/builders/-/builders-0.14.0.tgz#1915af10fa1c30d738b08b1ed0ae3c224fd491d7" - integrity sha512-+fqLIqa9wN3R+kvlld8sgG0nt04BAZxdCDP4t2qZ9TJsquLWA+xMtT8Waibb3d4li4AQS+IOfjiHAznv/dhHgQ== +"@discordjs/builders@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@discordjs/builders/-/builders-1.0.0.tgz#1ddc5a7f9d20977e7414c02989169bb7f55294ba" + integrity sha512-8y91ZfpOHubiGJu5tVyGI9tQCEyHZDTeqUWVcJd0dq7B96xIf84S0L4fwmD1k9zTe1eqEFSk0gc7BpY+FKn7Ww== dependencies: - "@sapphire/shapeshift" "^3.1.0" - "@sindresorhus/is" "^4.6.0" - discord-api-types "^0.33.3" + "@sapphire/shapeshift" "^3.5.1" + discord-api-types "^0.36.2" fast-deep-equal "^3.1.3" ts-mixer "^6.0.1" tslib "^2.4.0" @@ -361,10 +360,10 @@ resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-0.2.4.tgz#c8ff2250430dcec7324dd4aafd1ccbcbdfa9ac14" integrity sha512-PVrEJH+V6Ob0OwfagYQ/57kwt/HNEJxt5jqY4P+S3st9y29t9iokdnGMQoJXG5VEMAQIPbzu9Snw1F6yE8PdLA== -"@discordjs/collection@^0.7.0": - version "0.7.0" - resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-0.7.0.tgz#1a6c00198b744ba2b73a64442145da637ac073b8" - integrity sha512-R5i8Wb8kIcBAFEPLLf7LVBQKBDYUL+ekb23sOgpkpyGT+V4P7V83wTxcsqmX+PbqHt4cEHn053uMWfRqh/Z/nA== +"@discordjs/collection@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-1.0.0.tgz#4d777d87e56640a200200e7f5605c0fba05ac1b8" + integrity sha512-nAxDQYE5dNAzEGQ7HU20sujDsG5vLowUKCEqZkKUIlrXERZFTt/60zKUj/g4+AVCGeq+pXC5hivMaNtiC+PY5Q== "@discordjs/rest@^0.1.0-canary.0": version "0.1.0-canary.0" @@ -380,6 +379,19 @@ node-fetch "^2.6.1" tslib "^2.3.0" +"@discordjs/rest@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@discordjs/rest/-/rest-1.0.0.tgz#624ac48cf8f66f46d47371323963a0c0617ddd63" + integrity sha512-uDAvnE0P2a8axMdD4C51EGjvCRQ2HZk2Yxf6vHWZgIqG87D8DGKMPwmquIxrrB07MjV+rwci2ObU+mGhGP+bJg== + dependencies: + "@discordjs/collection" "^1.0.0" + "@sapphire/async-queue" "^1.3.2" + "@sapphire/snowflake" "^3.2.2" + discord-api-types "^0.36.2" + file-type "^17.1.2" + tslib "^2.4.0" + undici "^5.7.0" + "@eslint/eslintrc@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" @@ -657,21 +669,29 @@ resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.3.0.tgz#98b1b364a5fe820366a786827f2e987590de5964" integrity sha512-z+CDw5X4UgIEpZL8KM+ThVx1i8V60HBg0l/oFewTNbQQeRDJHdVxHyJykv+SF1H+Rc8EkMS81VTWo95jVYgO/g== -"@sapphire/async-queue@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.3.1.tgz#9d861e626dbffae02d808e13f823d4510e450a78" - integrity sha512-FFTlPOWZX1kDj9xCAsRzH5xEJfawg1lNoYAA+ecOWJMHOfiZYb1uXOI3ne9U4UILSEPwfE68p3T9wUHwIQfR0g== +"@sapphire/async-queue@^1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.3.2.tgz#befe5f5025e2e317a9eba2d1a24ca5d2e4576f86" + integrity sha512-rUpMLATsoAMnlN3gecAcr9Ecnw1vG7zi5Xr+IX22YzRzi1k9PF9vKzoT8RuEJbiIszjcimu3rveqUnvwDopz8g== -"@sapphire/shapeshift@^3.1.0": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@sapphire/shapeshift/-/shapeshift-3.4.1.tgz#68901b77c7903e404d8706b2227173fd8aae7568" - integrity sha512-OSR/yVE6butSlp/yvKntcg92k8IIDeTccfz1fw69lTZN02+JJ2GyKnA3Z1CLYelWc8Dh/yqO/iGTo9ypxFcAcg== +"@sapphire/shapeshift@^3.5.1": + version "3.5.1" + resolved "https://registry.yarnpkg.com/@sapphire/shapeshift/-/shapeshift-3.5.1.tgz#3bfd0e6bcfdced4ac26a6f450b5f7b8e49f4f2cc" + integrity sha512-7JFsW5IglyOIUQI1eE0g6h06D/Far6HqpcowRScgCiLSqTf3hhkPWCWotVTtVycnDCMYIwPeaw6IEPBomKC8pA== + dependencies: + fast-deep-equal "^3.1.3" + lodash.uniqwith "^4.5.0" "@sapphire/snowflake@^1.3.5": version "1.3.6" resolved "https://registry.yarnpkg.com/@sapphire/snowflake/-/snowflake-1.3.6.tgz#166e8c5c08d01c861edd7e2edc80b5739741715f" integrity sha512-QnzuLp+p9D7agynVub/zqlDVriDza9y3STArBhNiNBUgIX8+GL5FpQxstRfw1jDr5jkZUjcuKYAHxjIuXKdJAg== +"@sapphire/snowflake@^3.2.2": + version "3.2.2" + resolved "https://registry.yarnpkg.com/@sapphire/snowflake/-/snowflake-3.2.2.tgz#faacdc1b5f7c43145a71eddba917de2b707ef780" + integrity sha512-ula2O0kpSZtX9rKXNeQMrHwNd7E4jPDJYUXmEGTFdMRfyfMw+FPyh04oKMjAiDuOi64bYgVkOV3MjK+loImFhQ== + "@sinclair/typebox@^0.23.3": version "0.23.4" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.23.4.tgz#6ff93fd2585ce44f7481c9ff6af610fbb5de98a4" @@ -682,11 +702,6 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ== -"@sindresorhus/is@^4.6.0": - version "4.6.0" - resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f" - integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== - "@sinonjs/commons@^1.7.0": version "1.8.3" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" @@ -708,6 +723,11 @@ dependencies: defer-to-connect "^1.0.1" +"@tokenizer/token@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@tokenizer/token/-/token-0.3.0.tgz#fe98a93fe789247e998c75e74e9c7c63217aa276" + integrity sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A== + "@types/babel__core@^7.1.14": version "7.1.19" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.19.tgz#7b497495b7d1b4812bdb9d02804d0576f43ee460" @@ -767,18 +787,10 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/node-fetch@^2.6.1": - version "2.6.2" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.2.tgz#d1a9c5fd049d9415dce61571557104dec3ec81da" - integrity sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A== - dependencies: - "@types/node" "*" - form-data "^3.0.0" - "@types/node@*": - version "18.0.3" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.3.tgz#463fc47f13ec0688a33aec75d078a0541a447199" - integrity sha512-HzNRZtp4eepNitP+BD6k2L6DROIDG4Q0fm4x+dwfsr6LGmROENnok75VGw40628xf+iR24WeMFcHuuBDUAzzsQ== + version "18.0.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.6.tgz#0ba49ac517ad69abe7a1508bc9b3a5483df9d5d7" + integrity sha512-/xUq6H2aQm261exT6iZTMifUySEt4GR5KX8eYyY+C4MSNPqSh9oNIP7tz2GLKTlFaiBbgZNxffoR3CVRG+cljw== "@types/prettier@^2.1.5": version "2.6.0" @@ -1347,25 +1359,27 @@ discord-api-types@^0.18.1: resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.18.1.tgz#5d08ed1263236be9c21a22065d0e6b51f790f492" integrity sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg== -discord-api-types@^0.33.3: - version "0.33.5" - resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.33.5.tgz#6548b70520f7b944c60984dca4ab58654d664a12" - integrity sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg== +discord-api-types@^0.36.2: + version "0.36.2" + resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.36.2.tgz#2362bc544837be965ec99a5919f900c9699a7028" + integrity sha512-TunPAvzwneK/m5fr4hxH3bMsrtI22nr9yjfHyo5NBGMjpsAauGNiGCmwoFf0oO3jSd2mZiKUvZwCKDaB166u2Q== -discord.js@^13.5.1: - version "13.8.1" - resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-13.8.1.tgz#37627154a887ac395ca72dd814bc7366776bb90a" - integrity sha512-jOsD+4tEZWWx0RHVyH+FBcqoTrsL+d5Mm5p+ULQOdU0qSaxhLNkWYig+yDHNZoND7nlkXX3qi+BW+gO5erWylg== +discord.js@^14.0.3: + version "14.0.3" + resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-14.0.3.tgz#ee9d51030b130b3a00f7fc3e75dc2352b24350ea" + integrity sha512-wH/VQl4CqN8/+dcXEtYis1iurqxGlDpEe0O4CqH5FGqZGIjVpTdtK0STXXx7bVNX8MT/0GvLZLkmO/5gLDWZVg== dependencies: - "@discordjs/builders" "^0.14.0" - "@discordjs/collection" "^0.7.0" - "@sapphire/async-queue" "^1.3.1" - "@types/node-fetch" "^2.6.1" + "@discordjs/builders" "^1.0.0" + "@discordjs/collection" "^1.0.0" + "@discordjs/rest" "^1.0.0" + "@sapphire/snowflake" "^3.2.2" "@types/ws" "^8.5.3" - discord-api-types "^0.33.3" - form-data "^4.0.0" - node-fetch "^2.6.1" - ws "^8.7.0" + discord-api-types "^0.36.2" + fast-deep-equal "^3.1.3" + lodash.snakecase "^4.1.1" + tslib "^2.4.0" + undici "^5.8.0" + ws "^8.8.1" doctrine@^3.0.0: version "3.0.0" @@ -1631,6 +1645,15 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" +file-type@^17.1.2: + version "17.1.2" + resolved "https://registry.yarnpkg.com/file-type/-/file-type-17.1.2.tgz#9257437a64e0c3623f70d9f27430522d978b1384" + integrity sha512-3thBUSfa9YEUEGO/NAAiQGvjujZxZiJTF6xNwyDn6kB0NcEtwMn5ttkGG9jGwm/Nt/t8U1bpBNqyBNZCz4F4ig== + dependencies: + readable-web-to-node-stream "^3.0.2" + strtok3 "^7.0.0-alpha.7" + token-types "^5.0.0-alpha.2" + fill-range@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" @@ -1659,15 +1682,6 @@ flatted@^3.1.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3" integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg== -form-data@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" - integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -1838,7 +1852,7 @@ humanize-duration@^3.27.1: resolved "https://registry.yarnpkg.com/humanize-duration/-/humanize-duration-3.27.1.tgz#2cd4ea4b03bd92184aee6d90d77a8f3d7628df69" integrity sha512-jCVkMl+EaM80rrMrAPl96SGG4NRac53UyI1o/yAzebDntEY6K6/Fj2HOjdPg8omTqIe5Y0wPBai2q5xXrIbarA== -ieee754@^1.1.13: +ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== @@ -1887,7 +1901,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2: +inherits@2, inherits@^2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -2504,11 +2518,21 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== +lodash.snakecase@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d" + integrity sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw== + lodash.truncate@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= +lodash.uniqwith@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz#7a0cbf65f43b5928625a9d4d0dc54b18cadc7ef3" + integrity sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q== + lowercase-keys@^1.0.0, lowercase-keys@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" @@ -2791,6 +2815,11 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +peek-readable@^5.0.0-alpha.5: + version "5.0.0-alpha.5" + resolved "https://registry.yarnpkg.com/peek-readable/-/peek-readable-5.0.0-alpha.5.tgz#ace5dfedf7bc33f17c9b5170b9d54f69a4fba79b" + integrity sha512-pJohF/tDwV3ntnT5+EkUo4E700q/j/OCDuPxtM+5/kFGjyOai/sK4/We4Cy1MB2OiTQliWU5DxPvYIKQAdPqAA== + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -2886,6 +2915,22 @@ react-is@^18.0.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.1.0.tgz#61aaed3096d30eacf2a2127118b5b41387d32a67" integrity sha512-Fl7FuabXsJnV5Q1qIOQwx/sagGF18kogb4gpfcG4gjLBWO0WDiiz1ko/ExayuxE7InyQkBLkxRFG5oxY6Uu3Kg== +readable-stream@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readable-web-to-node-stream@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz#5d52bb5df7b54861fd48d015e93a2cb87b3ee0bb" + integrity sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw== + dependencies: + readable-stream "^3.6.0" + readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" @@ -2972,6 +3017,11 @@ safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + saslprep@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/saslprep/-/saslprep-1.0.3.tgz#4c02f946b56cf54297e347ba1093e7acac4cf226" @@ -3120,6 +3170,13 @@ string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2 is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -3147,6 +3204,14 @@ strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= +strtok3@^7.0.0-alpha.7: + version "7.0.0-alpha.8" + resolved "https://registry.yarnpkg.com/strtok3/-/strtok3-7.0.0-alpha.8.tgz#23a7870974e0494b58b14af6dd1c2c67cf13314d" + integrity sha512-u+k19v+rTxBjGYxncRQjGvZYwYvEd0uP3D+uHKe/s4WB1eXS5ZwpZsTlBu5xSS4zEd89mTXECXg6WW3FSeV8cA== + dependencies: + "@tokenizer/token" "^0.3.0" + peek-readable "^5.0.0-alpha.5" + supports-color@^5.3.0, supports-color@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -3241,6 +3306,14 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +token-types@^5.0.0-alpha.2: + version "5.0.0-alpha.2" + resolved "https://registry.yarnpkg.com/token-types/-/token-types-5.0.0-alpha.2.tgz#e43d63b2a8223a593d1c782a5149bec18f1abf97" + integrity sha512-EsG9UxAW4M6VATrEEjhPFTKEUi1OiJqTUMIZOGBN49fGxYjZB36k0p7to3HZSmWRoHm1QfZgrg3e02fpqAt5fQ== + dependencies: + "@tokenizer/token" "^0.3.0" + ieee754 "^1.2.1" + touch@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.0.tgz#fe365f5f75ec9ed4e56825e0bb76d24ab74af83b" @@ -3309,6 +3382,11 @@ undefsafe@^2.0.5: resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c" integrity sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA== +undici@^5.7.0, undici@^5.8.0: + version "5.8.0" + resolved "https://registry.yarnpkg.com/undici/-/undici-5.8.0.tgz#dec9a8ccd90e5a1d81d43c0eab6503146d649a4f" + integrity sha512-1F7Vtcez5w/LwH2G2tGnFIihuWUlc58YidwLiCv+jR2Z50x0tNXpRRw7eOIJ+GvqCqIkg9SB7NWAJ/T9TLfv8Q== + unique-string@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/unique-string/-/unique-string-2.0.0.tgz#39c6451f81afb2749de2b233e3f7c5e8843bd89d" @@ -3350,6 +3428,11 @@ url-parse-lax@^3.0.0: dependencies: prepend-http "^2.0.0" +util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + v8-compile-cache@^2.0.3: version "2.3.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" @@ -3448,10 +3531,10 @@ write-file-atomic@^4.0.1: imurmurhash "^0.1.4" signal-exit "^3.0.7" -ws@^8.7.0: - version "8.8.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.8.0.tgz#8e71c75e2f6348dbf8d78005107297056cb77769" - integrity sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ== +ws@^8.8.1: + version "8.8.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.8.1.tgz#5dbad0feb7ade8ecc99b830c1d77c913d4955ff0" + integrity sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA== xdg-basedir@^4.0.0: version "4.0.0"