diff --git a/package-lock.json b/package-lock.json index 4565e36f0ee..d517b6641ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "canvas": "^2.8.0", "country-emoji": "^1.5.6", "countryjs": "^1.8.0", - "discord.js": "^13.0.0-dev.e980948de55e91e59c9e3293ac76bc645a058a53", + "discord.js": "^13.0.0-dev.02693bc02f45980d8165820a103220f0027b96b7", "lodash": "^4.17.21", "mongodb": "^3.6.9", "node-fetch": "^2.6.1", @@ -74,9 +74,9 @@ } }, "node_modules/@sapphire/async-queue": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.2.tgz", - "integrity": "sha512-NkR7AzC9uyb++tMIZgG4X0ci8JM1rnvNmKbLwY42RgotRV8JGUntZ7ZpR7MN7p5zPlVdKo/YmOqcCCsBJ6LNuw==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.3.tgz", + "integrity": "sha512-pyV+0njfBq6rHKEOpux5xy2cEM5u9KFjVzpmKsgk/8mdslLCuNXX4QvxWsSerLq/EtLhkvvl998cdFbGtpHa9Q==", "engines": { "node": ">=14", "npm": ">=6" @@ -101,13 +101,12 @@ "version": "4.14.170", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.170.tgz", "integrity": "sha512-bpcvu/MKHHeYX+qeEN8GE7DIravODWdACVA1ctevD8CN24RhPZIKMn9ntfAsrvLfSX3cR5RrBKAbYm9bGs0A+Q==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@types/mongodb": { - "version": "3.6.17", - "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.17.tgz", - "integrity": "sha512-9hhgvYPdC5iHyyksPcKCu45gfaAIPQHKHGdvNXu4582DmOZX3wrUJIJPT40o4G1oTKPgpMMFqZglOTjhnYoF+A==", + "version": "3.6.18", + "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.18.tgz", + "integrity": "sha512-JSVFt9p0rTfZ4EgzXmVHUB3ue00xe3CRbQho8nXfImzEDDM4O7I3po1bwbWl/EIbLENxUreZxqLOc8lvcnLVPA==", "dev": true, "dependencies": { "@types/bson": "*", @@ -115,9 +114,9 @@ } }, "node_modules/@types/node": { - "version": "15.12.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.1.tgz", - "integrity": "sha512-zyxJM8I1c9q5sRMtVF+zdd13Jt6RU4r4qfhTd7lQubyThvLfx6yYekWSQjGCGV2Tkecgxnlpl/DNlb6Hg+dmEw==" + "version": "15.12.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.2.tgz", + "integrity": "sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==" }, "node_modules/@types/node-fetch": { "version": "2.5.10", @@ -439,9 +438,9 @@ } }, "node_modules/discord.js": { - "version": "13.0.0-dev.e980948de55e91e59c9e3293ac76bc645a058a53", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.e980948de55e91e59c9e3293ac76bc645a058a53.tgz", - "integrity": "sha512-Yzo1TWz3uf8Okjn7f10TdR0Yrj/qKdm7V8mj3rOUqjelqHQSB0o7tZBEWsa3YFDQyPz1N/FRmmCGqUOCQq26tQ==", + "version": "13.0.0-dev.02693bc02f45980d8165820a103220f0027b96b7", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.02693bc02f45980d8165820a103220f0027b96b7.tgz", + "integrity": "sha512-nzbmF5MLSjpdr8DS7SpC9q291NQ8XkHlledM4lz+uFJ4YgnMmTpi6e0FgF7v2kpTJPqTsXDRY3rWBv6Dat+08A==", "dependencies": { "@discordjs/collection": "^0.1.6", "@discordjs/form-data": "^3.0.1", @@ -450,8 +449,6 @@ "abort-controller": "^3.0.0", "discord-api-types": "^0.18.1", "node-fetch": "^2.6.1", - "prism-media": "^1.2.9", - "tweetnacl": "^1.0.3", "ws": "^7.4.6" }, "engines": { @@ -985,31 +982,6 @@ "node": ">=8" } }, - "node_modules/prism-media": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.2.9.tgz", - "integrity": "sha512-UHCYuqHipbTR1ZsXr5eg4JUmHER8Ss4YEb9Azn+9zzJ7/jlTtD1h0lc4g6tNx3eMlB8Mp6bfll0LPMAV4R6r3Q==", - "peerDependencies": { - "@discordjs/opus": "^0.5.0", - "ffmpeg-static": "^4.2.7 || ^3.0.0 || ^2.4.0", - "node-opus": "^0.3.3", - "opusscript": "^0.0.8" - }, - "peerDependenciesMeta": { - "@discordjs/opus": { - "optional": true - }, - "ffmpeg-static": { - "optional": true - }, - "node-opus": { - "optional": true - }, - "opusscript": { - "optional": true - } - } - }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -1334,11 +1306,6 @@ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, - "node_modules/tweetnacl": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" - }, "node_modules/typescript": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz", @@ -1454,9 +1421,9 @@ } }, "@sapphire/async-queue": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.2.tgz", - "integrity": "sha512-NkR7AzC9uyb++tMIZgG4X0ci8JM1rnvNmKbLwY42RgotRV8JGUntZ7ZpR7MN7p5zPlVdKo/YmOqcCCsBJ6LNuw==" + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.3.tgz", + "integrity": "sha512-pyV+0njfBq6rHKEOpux5xy2cEM5u9KFjVzpmKsgk/8mdslLCuNXX4QvxWsSerLq/EtLhkvvl998cdFbGtpHa9Q==" }, "@types/bson": { "version": "4.0.3", @@ -1480,9 +1447,9 @@ "dev": true }, "@types/mongodb": { - "version": "3.6.17", - "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.17.tgz", - "integrity": "sha512-9hhgvYPdC5iHyyksPcKCu45gfaAIPQHKHGdvNXu4582DmOZX3wrUJIJPT40o4G1oTKPgpMMFqZglOTjhnYoF+A==", + "version": "3.6.18", + "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.18.tgz", + "integrity": "sha512-JSVFt9p0rTfZ4EgzXmVHUB3ue00xe3CRbQho8nXfImzEDDM4O7I3po1bwbWl/EIbLENxUreZxqLOc8lvcnLVPA==", "dev": true, "requires": { "@types/bson": "*", @@ -1490,9 +1457,9 @@ } }, "@types/node": { - "version": "15.12.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.1.tgz", - "integrity": "sha512-zyxJM8I1c9q5sRMtVF+zdd13Jt6RU4r4qfhTd7lQubyThvLfx6yYekWSQjGCGV2Tkecgxnlpl/DNlb6Hg+dmEw==" + "version": "15.12.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.2.tgz", + "integrity": "sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==" }, "@types/node-fetch": { "version": "2.5.10", @@ -1729,9 +1696,9 @@ "integrity": "sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg==" }, "discord.js": { - "version": "13.0.0-dev.e980948de55e91e59c9e3293ac76bc645a058a53", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.e980948de55e91e59c9e3293ac76bc645a058a53.tgz", - "integrity": "sha512-Yzo1TWz3uf8Okjn7f10TdR0Yrj/qKdm7V8mj3rOUqjelqHQSB0o7tZBEWsa3YFDQyPz1N/FRmmCGqUOCQq26tQ==", + "version": "13.0.0-dev.02693bc02f45980d8165820a103220f0027b96b7", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.02693bc02f45980d8165820a103220f0027b96b7.tgz", + "integrity": "sha512-nzbmF5MLSjpdr8DS7SpC9q291NQ8XkHlledM4lz+uFJ4YgnMmTpi6e0FgF7v2kpTJPqTsXDRY3rWBv6Dat+08A==", "requires": { "@discordjs/collection": "^0.1.6", "@discordjs/form-data": "^3.0.1", @@ -1740,8 +1707,6 @@ "abort-controller": "^3.0.0", "discord-api-types": "^0.18.1", "node-fetch": "^2.6.1", - "prism-media": "^1.2.9", - "tweetnacl": "^1.0.3", "ws": "^7.4.6" } }, @@ -2112,12 +2077,6 @@ "find-up": "^4.0.0" } }, - "prism-media": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.2.9.tgz", - "integrity": "sha512-UHCYuqHipbTR1ZsXr5eg4JUmHER8Ss4YEb9Azn+9zzJ7/jlTtD1h0lc4g6tNx3eMlB8Mp6bfll0LPMAV4R6r3Q==", - "requires": {} - }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -2376,11 +2335,6 @@ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, - "tweetnacl": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" - }, "typescript": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz", diff --git a/package.json b/package.json index a4857d9a8dd..55857a3299e 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "canvas": "^2.8.0", "country-emoji": "^1.5.6", "countryjs": "^1.8.0", - "discord.js": "^13.0.0-dev.e980948de55e91e59c9e3293ac76bc645a058a53", + "discord.js": "^13.0.0-dev.02693bc02f45980d8165820a103220f0027b96b7", "lodash": "^4.17.21", "mongodb": "^3.6.9", "node-fetch": "^2.6.1", diff --git a/src/commands/Admin/bulksend.ts b/src/commands/Admin/bulksend.ts index 0d6ba710363..8042dea5e99 100644 --- a/src/commands/Admin/bulksend.ts +++ b/src/commands/Admin/bulksend.ts @@ -31,7 +31,7 @@ const command: Command = { .setTitle(amount === 1 ? "Success! Message sent." : "Success! Messages sent.") .setDescription(`${sendTo}`) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } } diff --git a/src/commands/Admin/channel.ts b/src/commands/Admin/channel.ts index 9c29d13d861..15feb0f08ad 100644 --- a/src/commands/Admin/channel.ts +++ b/src/commands/Admin/channel.ts @@ -37,7 +37,7 @@ const command: Command = { .setTitle("Updated the information channel!") .setDescription(`Check it out at <#762341271611506708>!`) //server-info .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(successEmbed) + await interaction.reply({ embeds: [successEmbed] }) } else if (channelInput === "rules") { await rules(interaction) const successEmbed = new Discord.MessageEmbed() @@ -46,7 +46,7 @@ const command: Command = { .setTitle("Updated the rules channel!") .setDescription(`Check it out at <#796159719617986610>!`) //rules .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(successEmbed) + await interaction.reply({ embeds: [successEmbed] }) } else if (channelInput === "verify") { await verify(interaction) const successEmbed = new Discord.MessageEmbed() @@ -55,7 +55,7 @@ const command: Command = { .setTitle("Updated the verification channel!") .setDescription(`Check it out at <#569178590697095168>!`) //verify .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(successEmbed) + await interaction.reply({ embeds: [successEmbed] }) } else if (!channelInput) { await info(interaction) await verify(interaction) @@ -66,7 +66,7 @@ const command: Command = { .setTitle("All channels have been updated!") .setDescription(`Check them out at <#762341271611506708>, <#796159719617986610> and <#569178590697095168>!`) //server-info, rules and verify .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(successEmbed) + await interaction.reply({ embeds: [successEmbed] }) } } } @@ -83,7 +83,7 @@ async function info(interaction: Discord.CommandInteraction) { { name: "**Main Channels 💬**", value: "<#621298919535804426> - You can use this channel to talk about anything you want really.\n<#619662798133133312> - A text channel where you can post your favorite memes.\n<#712046319375482910> - Post pics of your or someone else's cute pets here.\n<#644620638878695424> - A special channel for special people that have boosted our server. Thank you!\n<#550951034332381184> - A text channel where you can suggest things you would like to see on this Discord server.\n<#549894938712866816> - A channel for you to use bot commands in.\n<#782267779008823326> - A channel for you to use music commands in.\n<#713084081579098152> - A text channel you can use when you can't speak in a voice chat." }, { name: "**Translation Channels 🔠**", value: "We offer channels for each one of the currently supported projects: **Hypixel**, **SkyblockAddons**, **Quickplay** and our **Bot**.\nEach category has 3 text channels: one for translators, one for proofreaders and one with the project's language status that gets updated every 20 minutes. They also have 2 voice channels: one for translators and one for proofreaders. If you have any questions related to your project, they should be sent here!" }, { name: "**Language-specific channels 🎏**", value: "We offer channels where translators and proofreaders (of the Hypixel and Quickplay projects) for specific languages can interact with one another! You can speak in English there, but we encourage you to speak the language you're translating. Please keep in mind these channels are not actively moderated. In case you need to report something that occured in these channels, please contact an administrator." }) - channelsMessage.edit(null, channelsEmbed) + channelsMessage.edit({ content: null, embeds: [channelsEmbed] }) const botsMessage = await serverInfo.messages.fetch("800415710508744744"), botsEmbed = new Discord.MessageEmbed() @@ -94,7 +94,7 @@ async function info(interaction: Discord.CommandInteraction) { { name: "**Bots**", value: "<@620364412649209864> - Our personalised bot! It is currently maintained by <@240875059953139714> and has a bunch of useful features.\n<@155149108183695360> - This is Dyno. He is used for moderation purposes and nothing else, so don't mind him.\n<@294882584201003009> - This is the bot that runs our giveaways in <#787050912005881876>.\n<@235088799074484224> - Rythm can play some good tunes (or memes, you choose) in a voice channel.\n<@472911936951156740> - VoiceMaster allows you to create custom voice channels by joining the channel `Join to Create` and you can use <#549894938712866816> to customise them." }, { name: "**Custom informational commands**", value: "**`+guide`** - Gives you the link to the Hypixel project's guidelines. This is the only command that's allowed in all channels.\n**`+invite`** - Gives you the invite link to this server, please use this when you want to invite someone.\n**`+thread`** - Gives you the link to the thread regarding this Discord server.\n**`+twitter`** - Gives you the link to our Twitter page.\n**`+hypixel`** - Gives you some useful information about the Hypixel Crowdin project.\n**`+quickplay`** - Gives you some useful information about the Quickplay Crowdin project.\n**`+sba`** - Gives you some useful information about the SkyblockAddons Crowdin project." } ) - botsMessage.edit(null, botsEmbed) + botsMessage.edit({ content: null, embeds: [botsEmbed] }) const rolesMessage = await serverInfo.messages.fetch("800415711864029204"), rolesEmbed = new Discord.MessageEmbed() @@ -109,7 +109,7 @@ async function info(interaction: Discord.CommandInteraction) { { name: "**Reaction Roles**", value: `You can react to this message to receive the roles below, here's what they do:\n<@&646098170794868757> - React with 📊 to be notified whenever a new poll is posted on <#646096405252800512>\n<@&732615152246980628> - React with 🤖 to be notified whenever a new major update to <@${interaction.client.user!.id}> is posted on <#732587569744838777>\n<@&801052623745974272> - React with 🎉 to be notified of future giveaways in <#787050912005881876>!` } ) .setFooter("Need help? Ask your questions in #off-topic | Bot made with lots of care by QkeleQ10#6163") - rolesMessage.edit(null, rolesEmbed) + rolesMessage.edit({ content: null, embeds: [rolesEmbed] }) } async function rules(interaction: Discord.CommandInteraction) { @@ -131,7 +131,7 @@ async function rules(interaction: Discord.CommandInteraction) { { name: "And most importantly have fun!", value: "If you see something against the rules or something that makes you feel unsafe, please let staff know. We want this server to be a welcoming space for everyone!" } ) .setFooter("Have any questions? Ask any staff member, they're here to help!") - rulesMessage.edit(null, rulesEmbed) + rulesMessage.edit({ content: null, embeds: [rulesEmbed] }) } async function verify(interaction: Discord.CommandInteraction) { @@ -149,7 +149,7 @@ async function verify(interaction: Discord.CommandInteraction) { { name: "Need help?", value: "Feel free to send a message on this channel, or DM either <@240875059953139714>, <@241926666400563203> or <@435546264432803840> with any questions you might have!" } ) .setFooter("Have fun on our server!") - verifyMessage.edit("**Please read the entire message before sending anything on the channel.**", verifyEmbed) + verifyMessage.edit({ content: "**Please read the entire message before sending anything on the channel.**", embeds: [verifyEmbed] }) } export default command diff --git a/src/commands/Admin/crowdinverify.ts b/src/commands/Admin/crowdinverify.ts index 54b232cb621..056f4ea053a 100644 --- a/src/commands/Admin/crowdinverify.ts +++ b/src/commands/Admin/crowdinverify.ts @@ -17,7 +17,7 @@ const command: Command = { .setTitle("All verified users had their roles updated!") .setDescription("Check the console for any errors that may have occured in the process") .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.editReply(embed) + await interaction.editReply({ embeds: [embed] }) } } diff --git a/src/commands/Admin/giveaway.ts b/src/commands/Admin/giveaway.ts index 16924b45cbd..8e9a72893a5 100644 --- a/src/commands/Admin/giveaway.ts +++ b/src/commands/Admin/giveaway.ts @@ -21,10 +21,10 @@ const command: Command = { async execute(interaction: Discord.CommandInteraction) { const giveawayMsg = await (interaction.channel as Discord.TextChannel).messages.fetch((interaction.options.get("messageid")!.value as Discord.Snowflake)) .catch(err => { - return interaction.reply("Couldn't find that message! Here's the error:\n" + err, { ephemeral: true }) + return interaction.reply({ content: "Couldn't find that message! Here's the error:\n" + err, ephemeral: true }) }) as Discord.Message const users = await giveawayMsg.reactions.cache.get("🎉")?.users.fetch() as Discord.Collection - if (!users) return interaction.reply("That message doesn't have any 🎉 reactions.", { ephemeral: true }) + if (!users) return interaction.reply({ content: "That message doesn't have any 🎉 reactions.", ephemeral: true }) const winners: (Discord.User | undefined)[] = users.random(Number(interaction.options.get("winners")?.value) || 1) await interaction.reply(`Congratulations to ${winners.filter(user => user).join(", ")}`) } diff --git a/src/commands/Admin/holidays.ts b/src/commands/Admin/holidays.ts index 8d562b7e003..bec218c3e91 100644 --- a/src/commands/Admin/holidays.ts +++ b/src/commands/Admin/holidays.ts @@ -67,7 +67,7 @@ const command: Command = { await interaction.reply(`${holidayName.charAt(0).toUpperCase() + holidayName.slice(1)} announcement sent! Here's each language's translation:\n${debugMsg}`) console.table(log) console.log(`Sent the ${holidayName.charAt(0).toUpperCase() + holidayName.slice(1)} announcement`) - } else return interaction.reply("For some reason there is nothing in the announcement so I can't send it. Fix your code bro.", { ephemeral: true }) + } else return interaction.reply({ content: "For some reason there is nothing in the announcement so I can't send it. Fix your code bro.", ephemeral: true }) }) } } diff --git a/src/commands/Admin/inactives.ts b/src/commands/Admin/inactives.ts index 74fa20a05f1..074367c3e31 100644 --- a/src/commands/Admin/inactives.ts +++ b/src/commands/Admin/inactives.ts @@ -15,7 +15,7 @@ const command: Command = { .setAuthor("Inactive checker") .setTitle("All inactive members have been notified!") .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } } diff --git a/src/commands/Admin/members.ts b/src/commands/Admin/members.ts index 5a218b330c8..961399877bd 100644 --- a/src/commands/Admin/members.ts +++ b/src/commands/Admin/members.ts @@ -35,18 +35,18 @@ const command: Command = { .setAuthor("Members list") .setTitle(`Here are all the ${tags.length} members with the ${role.name} role on the server at the moment.`) .setDescription(membersArr.join(", ")) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } else if (index + 1 == maxMembersArr.length) { const embed = new Discord.MessageEmbed() .setColor(color) .setDescription(membersArr.join(", ")) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.followUp(embed) + await interaction.channel.send({ embeds: [embed] }) } else { const embed = new Discord.MessageEmbed() .setColor(color) .setDescription(membersArr.join(", ")) - await interaction.followUp(embed) + await interaction.channel.send({ embeds: [embed] }) } }) } else { @@ -56,7 +56,7 @@ const command: Command = { .setTitle(`Here are all the ${tags.length} members with the ${role.name} role on the server at the moment.`) .setDescription(maxMembersArr[0].join(", ")) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } } } diff --git a/src/commands/Admin/newlang.ts b/src/commands/Admin/newlang.ts index 91a0a7dbe70..c7b3d33e430 100644 --- a/src/commands/Admin/newlang.ts +++ b/src/commands/Admin/newlang.ts @@ -127,7 +127,7 @@ const command: Command = { { name: "Roles", value: `${translatorRole} and ${proofreaderRole}` } ) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.editReply(embed) + await interaction.editReply({ embeds: [embed] }) } } diff --git a/src/commands/Admin/restart.ts b/src/commands/Admin/restart.ts index d7b253052be..29f27e88abd 100644 --- a/src/commands/Admin/restart.ts +++ b/src/commands/Admin/restart.ts @@ -13,7 +13,7 @@ const command: Command = { .setAuthor("Restart") .setTitle("Restarting...") .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) interaction.client.user!.setStatus("invisible") setTimeout(() => { client.destroy() diff --git a/src/commands/Admin/stats.ts b/src/commands/Admin/stats.ts index 70c1bcf34f4..3090f515c1f 100644 --- a/src/commands/Admin/stats.ts +++ b/src/commands/Admin/stats.ts @@ -40,7 +40,7 @@ const command: Command = { .setTitle("All language statistics have been updated!") .setDescription(`Check them out at ${interaction.guild!.channels.cache.find(c => c.name === "hypixel-language-status")}, ${interaction.guild!.channels.cache.find(c => c.name === "sba-language-status")}, ${interaction.guild!.channels.cache.find(c => c.name === "bot-language-status")} and ${interaction.guild!.channels.cache.find(c => c.name === "quickplay-language-status")}`) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(allEmbed) + await interaction.reply({ embeds: [allEmbed] }) }) .catch(err => { throw err }) } else { @@ -57,7 +57,7 @@ const command: Command = { .setTitle(`The ${project} language statistics have been updated!`) .setDescription(`Check it out at ${interaction.guild!.channels.cache.find(c => c.name === `${projectInput}-language-status`)}!`) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(projectEmbed) + await interaction.reply({ embeds: [projectEmbed] }) console.log(`Manually updated the ${project} language statistics.`) } } diff --git a/src/commands/Info/levels.ts b/src/commands/Info/levels.ts index ea739f6faa7..e167270bab6 100644 --- a/src/commands/Info/levels.ts +++ b/src/commands/Info/levels.ts @@ -2,6 +2,7 @@ import Discord from "discord.js" import { neutralColor, errorColor } from "../../config.json" import { Command } from "../../index" import { db, DbUser } from "../../lib/dbclient" +import { updateButtonColors } from "../Utility/help" const command: Command = { name: "levels", @@ -35,23 +36,27 @@ const command: Command = { .setTitle(getString("pageTitle")) .setDescription(getString("pageNotExist")) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - return interaction.reply(embed) + return interaction.reply({ embeds: [embed] }) } else { let controlButtons = new Discord.MessageActionRow() .addComponents( new Discord.MessageButton() + .setStyle("SUCCESS") .setEmoji("⏮") .setCustomID("first") .setLabel(getString("pagination.first", "global")), new Discord.MessageButton() + .setStyle("SUCCESS") .setEmoji("◀️") .setCustomID("previous") .setLabel(getString("pagination.previous", "global")), new Discord.MessageButton() + .setStyle("SUCCESS") .setEmoji("▶️") .setCustomID("next") .setLabel(getString("pagination.next", "global")), new Discord.MessageButton() + .setStyle("SUCCESS") .setEmoji("⏭") .setCustomID("last") .setLabel(getString("pagination.last", "global")) @@ -64,7 +69,7 @@ const command: Command = { let pageEmbed: Discord.MessageEmbed collector.on("collect", async buttonInteraction => { - if (interaction.user.id !== buttonInteraction.user.id) return await buttonInteraction.reply(getString("pagination.notYours", { command: `/${this.name}` }, "global"), { ephemeral: true }) + if (interaction.user.id !== buttonInteraction.user.id) return await buttonInteraction.reply({ content: getString("pagination.notYours", { command: `/${this.name}` }, "global"), ephemeral: true }) else if (buttonInteraction.customID === "first") page = 0 else if (buttonInteraction.customID === "last") page = pages.length - 1 else if (buttonInteraction.customID === "previous") { @@ -81,7 +86,7 @@ const command: Command = { }) collector.on("end", async () => { - await interaction.editReply(getString("timeOut", { command: "`+levels`" }), { components: [], embeds: [pageEmbed] }) + await interaction.editReply({ content: getString("timeOut", { command: "`+levels`" }), components: [], embeds: [pageEmbed] }) }) } @@ -106,21 +111,4 @@ function fetchPage(page: number, pages: DbUser[][], getString: (path: string, va return pageEmbed } -function updateButtonColors(row: Discord.MessageActionRow, page: number, pages: DbUser[][]) { - if (page == 0) { - row.components.forEach(button => { - if (button.customID == "first" || button.customID == "previous") button.setStyle("SECONDARY") - else button.setStyle("SUCCESS") - }) - } else if (page == pages.length - 1) { - row.components.forEach(button => { - if (button.customID == "last" || button.customID == "next") button.setStyle("SECONDARY") - else button.setStyle("SUCCESS") - }) - } else { - row.components.forEach(button => button.setStyle("SUCCESS")) - } - return row -} - export default command diff --git a/src/commands/Info/ping.ts b/src/commands/Info/ping.ts index 32df8406857..d948064ec42 100644 --- a/src/commands/Info/ping.ts +++ b/src/commands/Info/ping.ts @@ -30,7 +30,7 @@ const command: Command = { .setTitle(getString("pong", { pingEmote: "<:ping:620954198493888512>" })) .setDescription(getString("message", { ping: ping })) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } } diff --git a/src/commands/Info/profile.ts b/src/commands/Info/profile.ts index 9a13c79955b..2a4cfbc5a81 100644 --- a/src/commands/Info/profile.ts +++ b/src/commands/Info/profile.ts @@ -34,14 +34,14 @@ const command: Command = { .setTitle(`Here's ${user.tag}'s Crowdin profile`) .setDescription(userDb.profile) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - return interaction.reply(embed) + return interaction.reply({ embeds: [embed] }) } else { const embed = new Discord.MessageEmbed() .setColor(errorColor) .setAuthor("Crowdin Profile") .setTitle(`Couldn't find ${user.tag}'s Crowdin profile on the database!`) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - return interaction.reply(embed) + return interaction.reply({ embeds: [embed] }) } } else { if (/(https:\/\/)?(www\.)?crowdin\.com\/profile\/\S{1,}/gi.test(profile)) { @@ -57,7 +57,7 @@ const command: Command = { { name: "New profile", value: profile } ) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - return interaction.reply(embed) + return interaction.reply({ embeds: [embed] }) } else { const embed = new Discord.MessageEmbed() .setColor(errorColor) @@ -65,7 +65,7 @@ const command: Command = { .setTitle(`Couldn't update ${user.tag}'s Crowdin profile!`) .setDescription(`Their current profile is the same as the one you tried to add.`) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - return interaction.reply(embed) + return interaction.reply({ embeds: [embed] }) } }) } else throw "wrongLink" diff --git a/src/commands/Info/rank.ts b/src/commands/Info/rank.ts index 9ab082b47d6..5b2273df960 100644 --- a/src/commands/Info/rank.ts +++ b/src/commands/Info/rank.ts @@ -29,7 +29,7 @@ const command: Command = { .setTitle(user.id === interaction.user.id ? getString("youNotRanked") : getString("userNotRanked")) .setDescription(getString("howRank")) .setFooter(executedBy, interaction.user.displayAvatarURL()) - return interaction.reply(errorEmbed) + return interaction.reply({ embeds: [errorEmbed] }) } const totalXp = getXpNeeded(userDb.levels.level), progressBar = generateProgressBar(userDb.levels?.levelXp, totalXp), @@ -44,7 +44,7 @@ const command: Command = { .setDescription(user.id === interaction.user.id ? getString("youLevel", { level: userDb.levels.level, rank: ranking }) : getString("userLevel", { user: String(user), level: userDb.levels.level, rank: ranking })) .addField(getString("textProgress", { currentXp: currentXp > 1000 ? `${(currentXp / 1000).toFixed(2)}${getString("thousand")}` : currentXp, xpNeeded: totalXp > 1000 ? `${(totalXp / 1000).toFixed(2)}${getString("thousand")}` : totalXp, messages: messageCount > 1000 ? `${(messageCount / 1000).toFixed(2)}${getString("thousand")}` : messageCount }), progressBar) .setFooter(executedBy, interaction.user.displayAvatarURL()) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } } diff --git a/src/commands/Info/tip.ts b/src/commands/Info/tip.ts index 5fabbfff20d..7a580880bc0 100644 --- a/src/commands/Info/tip.ts +++ b/src/commands/Info/tip.ts @@ -18,7 +18,7 @@ const command: Command = { .setAuthor(getString("tip", "global")) .setDescription(tip) .setFooter(executedBy, interaction.user.displayAvatarURL()) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } } diff --git a/src/commands/Projects/projects.ts b/src/commands/Projects/projects.ts index 922daa90c34..403af6f6e15 100644 --- a/src/commands/Projects/projects.ts +++ b/src/commands/Projects/projects.ts @@ -36,7 +36,7 @@ const command: Command = { { name: "Hypixel Translators Bot", value: `${getString("projectInfo", { project: "**Hypixel Translators Bot**", link: "https://crowdin.com/project/hypixel-translators-bot", command: "`+bot`" })}\n${joinedBot}` } ) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } else { const embed = new Discord.MessageEmbed() .setColor(neutralColor) @@ -50,7 +50,7 @@ const command: Command = { { name: "Hypixel Translators Bot", value: getString("projectInfo", { project: "**Hypixel Translators Bot**", link: "https://crowdin.com/project/hypixel-translators-bot", command: "`+bot`" }) } ) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } } } diff --git a/src/commands/Projects/translate.ts b/src/commands/Projects/translate.ts index 9809e1dddfb..affe7489a0d 100644 --- a/src/commands/Projects/translate.ts +++ b/src/commands/Projects/translate.ts @@ -22,7 +22,7 @@ const command: Command = { { name: getString("newCrowdin"), value: getString("checkGuide", { gettingStarted: "<#699275092026458122>" }) } ) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } else { const embed = new Discord.MessageEmbed() .setColor(neutralColor) @@ -36,7 +36,7 @@ const command: Command = { { name: getString("noLanguage"), value: getString("langRequest") } ) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } } } diff --git a/src/commands/Staff/check.ts b/src/commands/Staff/check.ts index 8ef826bb481..46ec5810ae2 100644 --- a/src/commands/Staff/check.ts +++ b/src/commands/Staff/check.ts @@ -29,7 +29,7 @@ const command: Command = { else if (userDb?.profile) note = userDb.profile let color = member!.displayHexColor - if (color == "#000000") color = blurple + if (color === "#000000") color = blurple let timeZone = getString("timeZone", "hypixelstats") if (timeZone.startsWith("crwdns")) timeZone = getString("timeZone", "hypixelstats", "en") const joined = member!.joinedAt!.toLocaleString("en-GB", { weekday: "long", year: "numeric", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit", timeZone: timeZone, timeZoneName: "short" }) @@ -56,7 +56,7 @@ const command: Command = { .setThumbnail(member!.user.displayAvatarURL({ format: "png", dynamic: true })) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) if (note) embed.addField("Note", note) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) function timeAgo(time: number) { let timeString: string if (time == 1) timeString = ` (${time} second ago)` diff --git a/src/commands/Staff/dm.ts b/src/commands/Staff/dm.ts index 553251c6181..5f811e83118 100644 --- a/src/commands/Staff/dm.ts +++ b/src/commands/Staff/dm.ts @@ -28,7 +28,7 @@ const command: Command = { .setDescription(message) .setFooter(getString("incomingDisclaimer", this.name, recipientDb.lang)) await interaction.defer() - recipient.send(dm) + recipient.send({ embeds: [dm] }) .then(async () => { const embed = new Discord.MessageEmbed() .setColor(successColor) @@ -36,7 +36,7 @@ const command: Command = { .setTitle(`Sent message to ${recipient.tag}`) .setDescription(message) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.editReply(embed) + await interaction.editReply({ embeds: [embed] }) }) .catch(async error => { const errorEmbed = new Discord.MessageEmbed() @@ -45,7 +45,7 @@ const command: Command = { .setTitle(`An error occured while trying to message ${recipient.tag}`) .setDescription(error.toString()) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.editReply(errorEmbed) + await interaction.editReply({ embeds: [errorEmbed] }) }) } } diff --git a/src/commands/Staff/say.ts b/src/commands/Staff/say.ts index f0847674292..a516fbc0730 100644 --- a/src/commands/Staff/say.ts +++ b/src/commands/Staff/say.ts @@ -35,7 +35,7 @@ const command: Command = { .setTitle("Success! Message sent.") .setDescription(`${sendTo}:\n${message}`) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } } diff --git a/src/commands/Staff/slowmode.ts b/src/commands/Staff/slowmode.ts index 3d1af0ff5d7..72d7fd0b450 100644 --- a/src/commands/Staff/slowmode.ts +++ b/src/commands/Staff/slowmode.ts @@ -13,10 +13,10 @@ const command: Command = { roleWhitelist: ["621071221462663169", "764442984119795732"], //Discord Moderator, Discord Administrator async execute(interaction: Discord.CommandInteraction) { const slowmode = Math.abs(interaction.options.get("seconds")!.value as number) - if (Number(slowmode) > 21600) return interaction.reply("The maximum slowmode you can set is 21600 seconds!", { ephemeral: true }) - if (!(interaction.channel instanceof Discord.TextChannel)) return interaction.reply("You can only set a slowmode in a text channel!", { ephemeral: true }) + if (Number(slowmode) > 21600) return interaction.reply({ content: "The maximum slowmode you can set is 21600 seconds!", ephemeral: true }) + if (!(interaction.channel instanceof Discord.TextChannel)) return interaction.reply({ content: "You can only set a slowmode in a text channel!", ephemeral: true }) await interaction.channel.setRateLimitPerUser(slowmode, `Set by ${interaction.user.tag}`) - await interaction.reply(`Successfully set the slowmode to ${interaction.options.get("seconds")!.value}`, { ephemeral: true }) + await interaction.reply({ content: `Successfully set the slowmode to ${interaction.options.get("seconds")!.value}`, ephemeral: true }) } } diff --git a/src/commands/Utility/8ball.ts b/src/commands/Utility/8ball.ts index 7a63facdce7..70377c9bcae 100644 --- a/src/commands/Utility/8ball.ts +++ b/src/commands/Utility/8ball.ts @@ -29,7 +29,7 @@ const command: Command = { else if (answerType === "inconclusive") embed.setColor(loadingColor) else if (answerType === "negative") embed.setColor(errorColor) else console.error("Help the 8ball answer type is weird") - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } } diff --git a/src/commands/Utility/help.ts b/src/commands/Utility/help.ts index 44b885e2807..1480e518447 100644 --- a/src/commands/Utility/help.ts +++ b/src/commands/Utility/help.ts @@ -45,8 +45,8 @@ const command: Command = { pageIndex++ }) - const commandInput = interaction.options.find(o => o.name == "command")?.value as string | undefined, - pageInput = interaction.options.find(o => o.name == "page")?.value as number | undefined + const commandInput = interaction.options.find(o => o.name === "command")?.value as string | undefined, + pageInput = interaction.options.find(o => o.name === "page")?.value as number | undefined if (!commandInput) { if (Number(pageInput) > pages.length || Number(pageInput) < 1) { @@ -104,7 +104,7 @@ const command: Command = { const collector = msg.createMessageComponentInteractionCollector((button: Discord.MessageComponentInteraction) => button.customID === "first" || button.customID === "previous" || button.customID === "next" || button.customID === "last", { time: this.cooldown! * 1000 }) collector.on("collect", async buttonInteraction => { - if (interaction.user.id !== buttonInteraction.user.id) return await buttonInteraction.reply(getString("pagination.notYours", { command: `/${this.name}` }, "global"), { ephemeral: true }) + if (interaction.user.id !== buttonInteraction.user.id) return await buttonInteraction.reply({ content: getString("pagination.notYours", { command: `/${this.name}` }, "global"), ephemeral: true }) else if (buttonInteraction.customID === "first") page = 0 else if (buttonInteraction.customID === "last") page = pages.length - 1 else if (buttonInteraction.customID === "previous") { @@ -121,7 +121,7 @@ const command: Command = { }) collector.on("end", async () => { - await interaction.editReply(getString("timeOut", { command: "`+help`" }), { embeds: [pageEmbed], components: [] }) + await interaction.editReply({ content: getString("timeOut", { command: "`+ help`" }), embeds: [pageEmbed], components: [] }) }) } else { @@ -151,7 +151,7 @@ const command: Command = { else embed.addField(getString("cooldownField"), `${command.cooldown} ${getString("seconds")}`, true) } } - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } } } @@ -176,23 +176,32 @@ function fetchPage(page: number, pages: Page[], getString: (path: string, variab return pageEmbed } -function updateButtonColors(row: Discord.MessageActionRow, page: number, pages: Page[]) { +export function updateButtonColors(row: Discord.MessageActionRow, page: number, pages: any[]) { if (page == 0) { row.components.forEach(button => { - if (button.customID == "first" || button.customID == "previous") button.setStyle("SECONDARY") - else button.setStyle("SUCCESS") + if (button.customID === "first" || button.customID === "previous") button + .setStyle("SECONDARY") + .setDisabled(true) + else button + .setStyle("SUCCESS") + .setDisabled(false) }) } else if (page == pages.length - 1) { row.components.forEach(button => { - if (button.customID == "last" || button.customID == "next") button.setStyle("SECONDARY") - else button.setStyle("SUCCESS") + if (button.customID === "last" || button.customID === "next") button + .setStyle("SECONDARY") + .setDisabled(true) + else button + .setStyle("SUCCESS") + .setDisabled(false) }) } else { - row.components.forEach(button => button.setStyle("SUCCESS")) + row.components.forEach(button => button + .setStyle("SUCCESS") + .setDisabled(false)) } return row } - interface Page { number: number commands?: string[] diff --git a/src/commands/Utility/hypixelstats.ts b/src/commands/Utility/hypixelstats.ts index 866c6fe11c0..404a6137667 100644 --- a/src/commands/Utility/hypixelstats.ts +++ b/src/commands/Utility/hypixelstats.ts @@ -212,12 +212,12 @@ const command: Command = { .addComponents( new Discord.MessageButton() .setCustomID("stats") - .setStyle(subCommand == "stats" ? "SECONDARY" : "SUCCESS") + .setStyle(subCommand === "stats" ? "SECONDARY" : "SUCCESS") .setEmoji("📊") .setLabel(getString("stats")), new Discord.MessageButton() .setCustomID("social") - .setStyle(subCommand == "social" ? "SECONDARY" : "SUCCESS") + .setStyle(subCommand === "social" ? "SECONDARY" : "SUCCESS") .setEmoji("twitter:821752918352068677") .setLabel(getString("social")) ) @@ -227,18 +227,18 @@ const command: Command = { const collector = msg.createMessageComponentInteractionCollector((button: Discord.MessageComponentInteraction) => button.customID === "stats" || button.customID === "social", { time: this.cooldown! * 1000 }) collector.on("collect", async buttonInteraction => { - if (interaction.user.id !== buttonInteraction.user.id) return await buttonInteraction.reply(getString("pagination.notYours", { command: `/${this.name}` }, "global"), { ephemeral: true }) + if (interaction.user.id !== buttonInteraction.user.id) return await buttonInteraction.reply({ content: getString("pagination.notYours", { command: `/${this.name}` }, "global"), ephemeral: true }) else if (buttonInteraction.customID === "stats") embed = await stats() else if (buttonInteraction.customID === "social") embed = await social() controlButtons.components.forEach(button => { - if (button.customID == buttonInteraction.customID) button.setStyle("SECONDARY") + if (button.customID === buttonInteraction.customID) button.setStyle("SECONDARY") else button.setStyle("SUCCESS") }) await buttonInteraction.update({ embeds: [embed], components: [controlButtons] }) }) collector.on("end", () => { - interaction.editReply(getString("timeOut", { command: "`+hypixelstats`" }), { components: [], embeds: [embed] }) + interaction.editReply({ content: getString("timeOut", { command: "`+hypixelstats`" }), components: [], embeds: [embed] }) }) }) .catch(e => { diff --git a/src/commands/Utility/hypixelunverify.ts b/src/commands/Utility/hypixelunverify.ts index a74c53b6e1f..bd6291a048f 100644 --- a/src/commands/Utility/hypixelunverify.ts +++ b/src/commands/Utility/hypixelunverify.ts @@ -20,7 +20,7 @@ const command: Command = { .setAuthor(getString("moduleName")) .setTitle(getString("unverified")) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - return interaction.reply(embed) + return interaction.reply({ embeds: [embed] }) } else { const embed = new Discord.MessageEmbed() .setColor(errorColor) @@ -31,7 +31,6 @@ const command: Command = { return interaction.reply({ embeds: [embed], ephemeral: true }) } }) - client.cooldowns.get(this.name)!.delete(interaction.user.id) return }, } diff --git a/src/commands/Utility/hypixelverify.ts b/src/commands/Utility/hypixelverify.ts index 0f174060327..457262594a6 100644 --- a/src/commands/Utility/hypixelverify.ts +++ b/src/commands/Utility/hypixelverify.ts @@ -46,7 +46,7 @@ const command: Command = { .setTitle(getString("success", { player: json.username })) .setDescription(getString("role", { role: String(role) })) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - return await interaction.editReply(successEmbed) + return await interaction.editReply({ embeds: [successEmbed] }) } else { const notChanged = new Discord.MessageEmbed() .setColor(errorColor) @@ -54,7 +54,7 @@ const command: Command = { .setTitle(getString("alreadyVerified")) .setDescription(getString("nameChangeDisclaimer")) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - return await interaction.editReply(notChanged) + return await interaction.editReply({ embeds: [notChanged] }) } }) } else { @@ -65,7 +65,7 @@ const command: Command = { .setDescription(getString("tutorial", { tag: interaction.user.tag })) .setImage("https://i.imgur.com/JSeAHdG.gif") .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.editReply(errorEmbed) + await interaction.editReply({ embeds: [errorEmbed] }) } }) .catch(e => { diff --git a/src/commands/Utility/language.ts b/src/commands/Utility/language.ts index 15ab90b593b..9438c8fe501 100644 --- a/src/commands/Utility/language.ts +++ b/src/commands/Utility/language.ts @@ -61,11 +61,11 @@ const command: Command = { .setTitle(getString("listTitle")) .setDescription(langList.join("\n")) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } }) } else if (subCommand === "stats") { - if (!member.roles.cache.has("764442984119795732")) return interaction.reply("You do not have permission to execute this command", { ephemeral: true }) + if (!member.roles.cache.has("764442984119795732")) return interaction.reply({ content: getString("noAccess", "global"), ephemeral: true }) const files = fs.readdirSync(stringsFolder), langInput = interaction.options.first()!.options!.get("language")!.value as string if (!files.includes(langInput)) throw "falseLang" @@ -78,9 +78,9 @@ const command: Command = { .setTitle(`There ${langUsers.length === 1 ? `is ${langUsers.length} user` : `are ${langUsers.length} users`} using that language at the moment.`) .setFooter(`Executed By ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) if (langInput !== "en") embed.setDescription(users.join(", ")) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } - else if (subCommand == "set" && newLang) { + else if (subCommand === "set" && newLang) { if (newLang === "se") newLang = "sv" const langdb = await db.collection("langdb").find().toArray(), langdbEntry = langdb.find(l => l.name.toLowerCase() === newLang) @@ -98,7 +98,7 @@ const command: Command = { .setTitle(getString("changedToTitle", this.name, newLang)) .setDescription(getString("credits", this.name, newLang)) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - return interaction.reply(embed) + return interaction.reply({ embeds: [embed] }) } else { const embed = new Discord.MessageEmbed() .setColor(errorColor) @@ -106,7 +106,7 @@ const command: Command = { .setTitle(getString("didntChange", this.name, newLang)) .setDescription(getString("alreadyThis", this.name, newLang)) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - return interaction.reply(embed) + return interaction.reply({ embeds: [embed] }) } }) } else { @@ -116,7 +116,7 @@ const command: Command = { .setTitle(getString("didntChange")) .setDescription(getString("notTranslated")) .setFooter(executedBy, interaction.user.displayAvatarURL()) - return interaction.reply(embed) + return interaction.reply({ embeds: [embed] }) } } else { await fs.readdir(stringsFolder, async (_err, files) => { @@ -128,7 +128,7 @@ const command: Command = { .setTitle(getString("errorTitle")) .setDescription(`${getString("errorDescription")}\n\`${files.join("`, `")}\`\n${getString("suggestAdd")}`) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) }) } }) @@ -142,7 +142,7 @@ const command: Command = { .setTitle(getString("current")) .setDescription(`${getString("errorDescription")}\n\`${files.join("`, `")}\`\n\n${getString("credits")}`) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } } } diff --git a/src/commands/Utility/languagestats.ts b/src/commands/Utility/languagestats.ts index 5496166832c..94440edf2bb 100644 --- a/src/commands/Utility/languagestats.ts +++ b/src/commands/Utility/languagestats.ts @@ -79,7 +79,7 @@ const command: Command = { if (quickplayData) embed.addField("Quickplay", `${getString("translated", { percentage: quickplayData.translationProgress, translated: quickplayData.phrases.translated, total: quickplayData.phrases.total })}\n${getString("approved", { percentage: quickplayData.approvalProgress, approved: quickplayData.phrases.approved, total: quickplayData.phrases.total })}`) if (sbaData) embed.addField("SkyblockAddons", `${getString("translated", { percentage: sbaData.translationProgress, translated: sbaData.phrases.translated, total: sbaData.phrases.total })}\n${getString("approved", { percentage: sbaData.approvalProgress, approved: sbaData.phrases.approved, total: sbaData.phrases.total })}`) if (botData) embed.addField("Hypixel Translators Bot", `${getString("translated", { percentage: botData.translationProgress, translated: botData.phrases.translated, total: botData.phrases.total })}\n${getString("approved", { percentage: botData.approvalProgress, approved: botData.phrases.approved, total: botData.phrases.total })}`) - await interaction.editReply(embed) + await interaction.editReply({ embeds: [embed] }) }) }) }) diff --git a/src/commands/Utility/mention.ts b/src/commands/Utility/mention.ts index 9a35c367406..467a53e09a1 100644 --- a/src/commands/Utility/mention.ts +++ b/src/commands/Utility/mention.ts @@ -49,7 +49,7 @@ const command: Command = { const langs: { [key: string]: string } = { "Chinesesimplified": "Chinese Simplified", "Chinese-simplified": "Chinese Simplified", "Zhcn": "Chinese Simplified", "Chinesetraditional": "Chinese Traditional", "Chinese-traditional": "Chinese Traditional", "Zhtw": "Chinese Traditional", "Lolcat": "LOLCAT", "Lol": "LOLCAT", "Bg": "Bulgarian", "Cs": "Czech", "Da": "Danish", "Nl": "Dutch", "Fi": "Finnish", "Fr": "French", "De": "German", "El": "Greek", "It": "Italian", "Ja": "Japanese", "Ko": "Korean", "Ms": "Malay", "No": "Norwegian", "Pl": "Polish", "Pt": "Portuguese", "Ptbr": "Portuguese Brazilian", "Brazilian": "Portuguese Brazilian", "Ru": "Russian", "Es": "Spanish", "Sv": "Swedish", "Se": "Swedish", "Th": "Thai", "Tr": "Turkish", "Ua": "Ukrainian", "Enpt": "Pirate English", "Pirate": "Pirate English" } if (langs.hasOwnProperty(roleName)) roleName = langs[roleName] - const role = interaction.guild!.roles.cache.find(x => x.name == (`${roleName} Proofreader`)) + const role = interaction.guild!.roles.cache.find(x => x.name === (`${roleName} Proofreader`)) if (!role) throw "falseRole" if (roleType === "pf" || roleType === "pr" || roleType === "proofreader") { @@ -57,14 +57,14 @@ const command: Command = { if (member.roles.cache.find(role => role.name === `${roleName} Proofreader` || member.permissions.has("MANAGE_ROLES"))) { await interaction.reply(`**${interaction.user}**: ${toPing} ${message}`) } else { - await interaction.reply(`${getString("errorNoPing")}${getString("errorNoPingPr")} ${getString("errorNoPingDisclaimer")}`, { ephemeral: true }) + await interaction.reply({ content: `${getString("errorNoPing")}${getString("errorNoPingPr")} ${getString("errorNoPingDisclaimer")}`, ephemeral: true }) } } else if (roleType === "tr" || roleType === "translator") { const toPing = interaction.guild!.roles.cache.find(role => role.name === `${roleName} Translator`) if (member.roles.cache.find(role => role.name === `${roleName} Proofreader` || member.permissions.has("MANAGE_ROLES"))) { await interaction.reply(`**${interaction.user}**: ${toPing} ${message}`) } else { - await interaction.reply(`${getString("errorNoPing")}${getString("errorNoPingTr")} ${getString("errorNoPingDisclaimer")}`, { ephemeral: true }) + await interaction.reply({ content: `${getString("errorNoPing")}${getString("errorNoPingTr")} ${getString("errorNoPingDisclaimer")}`, ephemeral: true }) } } else if (roleType === "all" || roleType === "both") { const translatorPing = interaction.guild!.roles.cache.find(role => role.name === `${roleName} Translator`) @@ -72,7 +72,7 @@ const command: Command = { if (member.roles.cache.find(role => role.name === `${roleName} Proofreader` || member.permissions.has("MANAGE_ROLES"))) { await interaction.reply(`**${interaction.user}**: ${translatorPing} ${proofreaderPing} ${message}`) } else { - await interaction.reply(`${getString("errorNoPing")}${getString("errorNoPingAll")} ${getString("errorNoPingDisclaimer")}`, { ephemeral: true }) + await interaction.reply({ content: `${getString("errorNoPing")}${getString("errorNoPingAll")} ${getString("errorNoPingDisclaimer")}`, ephemeral: true }) } } else throw "falseRole" } diff --git a/src/commands/Utility/prefix.ts b/src/commands/Utility/prefix.ts index 255045ca91e..ace508c5770 100644 --- a/src/commands/Utility/prefix.ts +++ b/src/commands/Utility/prefix.ts @@ -60,7 +60,7 @@ const command: Command = { const collector = msg.createMessageComponentInteractionCollector((interaction: Discord.MessageComponentInteraction) => interaction.customID === "confirm" || interaction.customID === "cancel", { time: this.cooldown! * 1000 }) collector.on("collect", async buttonInteraction => { - if (interaction.user.id !== buttonInteraction.user.id) return await buttonInteraction.reply(getString("pagination.notYours", { command: `/${this.name}` }, "global"), { ephemeral: true }) + if (interaction.user.id !== buttonInteraction.user.id) return await buttonInteraction.reply({ content: getString("pagination.notYours", { command: `/${this.name}` }, "global"), ephemeral: true }) if (buttonInteraction.customID === "confirm") { if (member.nickname !== (`[${prefix}] ${nickNoPrefix}`)) { await member.setNickname(`[${prefix}] ${nickNoPrefix}`, "Used the prefix command") @@ -78,7 +78,7 @@ const command: Command = { .setTitle("A user manually changed their prefix") .setDescription(`${interaction.user} manually changed their prefix to include the following flag: ${prefix}\nMake sure they have the appropriate roles for this prefix and, if not, follow the appropriate procedure`) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })); - (interaction.client.channels.cache.get("624881429834366986") as Discord.TextChannel).send(staffAlert) //staff-bots + (interaction.client.channels.cache.get("624881429834366986") as Discord.TextChannel).send({ embeds: [staffAlert] }) //staff-bots }) .catch(async err => { const embed = new Discord.MessageEmbed() @@ -233,11 +233,11 @@ const command: Command = { await interaction.editReply({ embeds: [noChangesEmbed], components: [prefixButtons, controlButtons] }) const msg = await interaction.fetchReply() as Discord.Message - const collector = msg.createMessageComponentInteractionCollector((buttonInteraction: Discord.MessageComponentInteraction) => userLangs.includes(langdb.find(entry => entry.code == buttonInteraction.customID)!) || buttonInteraction.customID === "confirm" || buttonInteraction.customID === "cancel", { time: this.cooldown! * 1000 }) + const collector = msg.createMessageComponentInteractionCollector((buttonInteraction: Discord.MessageComponentInteraction) => userLangs.includes(langdb.find(entry => entry.code === buttonInteraction.customID)!) || buttonInteraction.customID === "confirm" || buttonInteraction.customID === "cancel", { time: this.cooldown! * 1000 }) collector.on('collect', async buttonInteraction => { - if (interaction.user.id !== buttonInteraction.user.id) return await buttonInteraction.reply(getString("pagination.notYours", { command: `/${this.name}` }, "global"), { ephemeral: true }) - if (buttonInteraction.customID !== "cancel") controlButtons.components.find(button => button.customID == "confirm")!.setDisabled(false) + if (interaction.user.id !== buttonInteraction.user.id) return await buttonInteraction.reply({ content: getString("pagination.notYours", { command: `/${this.name}` }, "global"), ephemeral: true }) + if (buttonInteraction.customID !== "cancel") controlButtons.components.find(button => button.customID === "confirm")!.setDisabled(false) if (buttonInteraction.customID === "confirm") { if (prefixes) { if (member.nickname !== (`[${prefixes}] ${nickNoPrefix}`)) { @@ -290,10 +290,10 @@ const command: Command = { .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) await buttonInteraction.update({ embeds: [embed], components: [] }) } else { - const clickedEntry = langdb.find(entry => entry.code == buttonInteraction.customID)! + const clickedEntry = langdb.find(entry => entry.code === buttonInteraction.customID)! if (prefixes) prefixes = `${prefixes}-${clickedEntry.emoji}` else prefixes = `${clickedEntry.emoji}` - prefixButtons.components.find(button => button.customID == buttonInteraction.customID)!.setDisabled(true) + prefixButtons.components.find(button => button.customID === buttonInteraction.customID)!.setDisabled(true) const embed = new Discord.MessageEmbed() .setColor(neutralColor) .setAuthor(getString("moduleName")) diff --git a/src/commands/Utility/quote.ts b/src/commands/Utility/quote.ts index 6ebdef6889e..f7c3066dc43 100644 --- a/src/commands/Utility/quote.ts +++ b/src/commands/Utility/quote.ts @@ -100,20 +100,20 @@ const command: Command = { .setTitle("A quote request has been submitted!") .setDescription(`${quote}\n - ${author}`) .setFooter("Suggested by " + interaction.user.tag, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - staffBots.send(`/quote add quote:${quote} author:@${author.tag}`, report) + staffBots.send({ content: `/quote add quote:${quote} author:@${author.tag}`, embeds: [report] }) const embed = new Discord.MessageEmbed() .setColor(successColor) .setAuthor(getString("moduleName")) .setTitle(getString("reqSub")) .setDescription(`${quote}\n - ${author}`) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } else await addQuote(interaction, quote, author, collection) } else if (subCommand === "edit" && allowed) await editQuote(interaction, collection) else if (subCommand === "delete" && allowed) await deleteQuote(interaction, collection) else if (subCommand === "link" && allowed) await linkQuote(interaction, collection) else if (subCommand === "get") await findQuote(executedBy, interaction, getString, collection) - else interaction.reply(getString("errors.noAccess", "global"), { ephemeral: true }) + else interaction.reply({ content: getString("errors.noAccess", "global"), ephemeral: true }) } } @@ -144,7 +144,7 @@ async function findQuote(executedBy: string, interaction: Discord.CommandInterac .setDescription(` - ${quote.author}`) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) if (quote.url) embed.addField(getString("msgUrl"), quote.url) - return interaction.reply(embed) + return interaction.reply({ embeds: [embed] }) } async function addQuote(interaction: Discord.CommandInteraction, quote: string, author: Discord.User, collection: Collection) { @@ -162,7 +162,7 @@ async function addQuote(interaction: Discord.CommandInteraction, quote: string, { name: "Quote number", value: `${quoteId}` } ]) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } async function editQuote(interaction: Discord.CommandInteraction, collection: Collection) { @@ -183,7 +183,7 @@ async function editQuote(interaction: Discord.CommandInteraction, collection: Co { name: "Link", value: r.value.link || "None" } ]) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } else { const embed = new Discord.MessageEmbed() .setColor(errorColor) @@ -211,7 +211,7 @@ async function deleteQuote(interaction: Discord.CommandInteraction, collection: { name: "Link", value: r.value.link || "None" } ) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } else { const embed = new Discord.MessageEmbed() .setColor(errorColor) @@ -241,7 +241,7 @@ async function linkQuote(interaction: Discord.CommandInteraction, collection: Co { name: "Author", value: r.value.author } ) .setFooter(`Executed by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - await interaction.reply(embed) + await interaction.reply({ embeds: [embed] }) } else { const embed = new Discord.MessageEmbed() .setColor(errorColor) diff --git a/src/commands/Utility/verify.ts b/src/commands/Utility/verify.ts index e5d0b515b23..7db5f91ab0c 100644 --- a/src/commands/Utility/verify.ts +++ b/src/commands/Utility/verify.ts @@ -37,7 +37,7 @@ const command: Command = { db.collection("users").updateOne({ id: member!.id }, { $unset: { unverifiedTimestamp: true } }); verifyLogs.send(`${interaction.user} manually verified themselves through the command`) client.cooldowns.get(this.name)!.delete(interaction.user.id) - await interaction.reply("You successfully verified yourself!", { ephemeral: true }) + await interaction.reply({ content: "You successfully verified yourself!", ephemeral: true }) } else if (!member.roles.cache.has("764442984119795732") || !profileUrl || /(https:\/\/)([a-z]{2,}\.)?crowdin\.com\/profile?\/?\S{1,}/gi.test(profileUrl)) { //Discord Administrator const userDb: DbUser = await db.collection("users").findOne({ id: interaction.user.id }) if (userDb.profile || profileUrl && /(https:\/\/)([a-z]{2,}\.)?crowdin\.com\/profile?\/?\S{1,}/gi.test(profileUrl)) { @@ -54,23 +54,23 @@ const command: Command = { .setTitle("You were successfully unverified!") .setDescription(`Since we didn't have your profile registered on our database, we'd like to ask you to kindly send it to us on the <#569178590697095168> channel. Please make sure your profile is public and that you have your Discord tag (${interaction.user.tag}) in your "About me" section.`) .setFooter("Any messages you send here will be sent to staff upon confirmation.") - interaction.user.send(embed) + interaction.user.send({ embeds: [embed] }) .then(async () => { await verifyLogs.send(`${interaction.user} tried to verify with an invalid profile URL or there was no profile stored for them.`) - await interaction.reply("Your request was processed, check your DMs for more info!", { ephemeral: true }) + await interaction.reply({ content: "Your request was processed, check your DMs for more info!", ephemeral: true }) }) .catch(async () => { embed .setDescription(`Since we didn't have your profile registered on our database, we'd like to ask you to kindly send it to us here. Please make sure your profile is public and that you have your Discord tag (${interaction.user.tag}) in your "About me" section.`) .setFooter("") await verifyLogs.send(`${interaction.user} was unverified and had DMs off.`) //verify-logs - await verify.send(`${interaction.user} you had DMs disabled, so here's our message:`, embed) //verify + await verify.send({ content: `${interaction.user} you had DMs disabled, so here's our message:`, embeds: [embed] }) //verify .then(msg => { setTimeout(() => { if (!msg.deleted) msg.delete() }, 30000) }) - await interaction.reply(`Your request was processed, check ${verify} for more info!`, { ephemeral: true }) + await interaction.reply({ content: `Your request was processed, check ${verify} for more info!`, ephemeral: true }) }) } } else { diff --git a/src/events/stats.ts b/src/events/stats.ts index 710fe4bdf04..bff2e7c5dfe 100644 --- a/src/events/stats.ts +++ b/src/events/stats.ts @@ -56,7 +56,7 @@ export async function hypixel(client: HTBClient) { .setDescription(`**${langData.translationProgress}% translated (${langData.phrases.translated}/${langData.phrases.total} strings)**\n${langData.approvalProgress}% approved (${langData.phrases.approved}/${langData.phrases.total} strings)\n\nTranslate at https://crowdin.com/translate/hypixel/all/en-${langData.language.code}`) .setFooter("Last update") .setTimestamp() - msg.edit(null, embed) + msg.edit({ content: null, embeds: [embed] }) index++ }) }) @@ -113,7 +113,7 @@ export async function quickplay(client: HTBClient) { .setDescription(`**${langData.translationProgress}% translated (${langData.phrases.translated}/${langData.phrases.total} strings)**\n${langData.approvalProgress}% approved (${langData.phrases.approved}/${langData.phrases.total} strings)\n\nTranslate at https://crowdin.com/translate/quickplay/all/en-${langData.language.code}`) .setFooter("Last update") .setTimestamp() - msg.edit(null, embed) + msg.edit({ content: null, embeds: [embed] }) index++ }) }) @@ -170,7 +170,7 @@ export async function bot(client: HTBClient) { .setDescription(`**${langData.translationProgress}% translated (${langData.phrases.translated}/${langData.phrases.total} strings)**\n${langData.approvalProgress}% approved (${langData.phrases.approved}/${langData.phrases.total} strings)\n\nTranslate at https://crowdin.com/translate/hypixel-translators-bot/all/en-${langData.language.code}`) .setFooter("Last update") .setTimestamp() - msg.edit(null, embed) + msg.edit({ content: null, embeds: [embed] }) index++ }) }) @@ -227,7 +227,7 @@ export async function skyblockaddons(client: HTBClient) { .setThumbnail((langData.language.flag)) .setFooter("Last update") .setTimestamp() - msg.edit(null, embed) + msg.edit({ content: null, embeds: [embed] }) index++ }) }) diff --git a/src/lib/crowdinverify.ts b/src/lib/crowdinverify.ts index 151fd87d9a8..131458373d9 100644 --- a/src/lib/crowdinverify.ts +++ b/src/lib/crowdinverify.ts @@ -50,11 +50,11 @@ async function crowdinVerify(member: Discord.GuildMember, url?: string, sendDms: errorEmbed .setDescription("Hey there! We noticed you tried to send us your Crowdin profile but the link you sent was invalid. This may have happened because you either typed the wrong name in the link or you sent us the generic Crowdin profile link. If you don't know how to obtain the profile URL, make sure it follows the format `https://crowdin.com/profile/` and replace with your username like shown below.\n\nIf you have any questions, be sure to send them to us!") .setImage("https://i.imgur.com/7FVOSfT.png") - if (sendDms) member.send(errorEmbed) + if (sendDms) member.send({ embeds: [errorEmbed] }) .then(() => verifyLogs.send(`${member} sent the wrong profile link. Let’s hope they work their way around with the message I just sent them.`)) .catch(() => { errorEmbed.setFooter("This message will be deleted in a minute") - verify.send(`${member} you had DMs disabled, so here's our message,`, errorEmbed) + verify.send({ content: `${member} you had DMs disabled, so here's our message,`, embeds: [errorEmbed] }) .then(msg => { setTimeout(() => { if (!msg.deleted) msg.delete() @@ -86,11 +86,11 @@ async function crowdinVerify(member: Discord.GuildMember, url?: string, sendDms: errorEmbed .setDescription("Hey there! We noticed you tried to send us your Crowdin profile but the link you sent was invalid. This may have happened because you either typed the wrong name in the link or you sent us the generic Crowdin profile link. If you don't know how to obtain the profile URL, make sure it follows the format `https://crowdin.com/profile/` and replace with your username like shown below.\n\nIf you have any questions, be sure to send them to us!") .setImage("https://i.imgur.com/7FVOSfT.png") - if (sendDms) member.send(errorEmbed) + if (sendDms) member.send({ embeds: [errorEmbed] }) .then(() => verifyLogs.send(`${member} sent the wrong profile link. Let’s hope they work their way around with the message I just sent them.`)) .catch(() => { errorEmbed.setFooter("This message will be deleted in a minute") - verify.send(`${member} you had DMs disabled, so here's our message,`, errorEmbed) + verify.send({ content: `${member} you had DMs disabled, so here's our message,`, embeds: [errorEmbed] }) .then(msg => { setTimeout(() => { if (!msg.deleted) msg.delete() @@ -111,11 +111,11 @@ async function crowdinVerify(member: Discord.GuildMember, url?: string, sendDms: errorEmbed .setDescription(`Hey there! We noticed you sent us your Crowdin profile, however, it was private so we couldn't check it. Please make it public, at least until you get verified, and send us your profile again on the channel. If you don't know how to, then go to your Crowdin profile settings (found [here](https://crowdin.com/settings#account)) and make sure the "Private Profile" setting is turned off (see the image below)\n\nIf you have any questions, be sure to send them to us!`) .setImage("https://i.imgur.com/YX8VLeu.png") - if (sendDms) member.send(errorEmbed) + if (sendDms) member.send({ embeds: [errorEmbed] }) .then(() => verifyLogs.send(`${member}'s profile was private, I let them know about that.`)) .catch(() => { errorEmbed.setFooter("This message will be deleted in a minute") - verify.send(`${member} you had DMs disabled, so here's our message,`, errorEmbed) + verify.send({ content: `${member} you had DMs disabled, so here's our message,`, embeds: [errorEmbed] }) .then(msg => { setTimeout(() => { if (!msg.deleted) msg.delete() @@ -143,11 +143,11 @@ async function crowdinVerify(member: Discord.GuildMember, url?: string, sendDms: errorEmbed .setDescription(`Hey there!\nWe noticed you sent us your Crowdin profile, however, you forgot to add your Discord tag to it! Just add ${member.user.tag} to your about section like shown in the image below. Once you've done so, send us the profile link again.\n\nIf you have any questions, be sure to send them to us!`) .setImage("https://i.imgur.com/BM2bJ4W.png") - if (sendDms) member.send(errorEmbed) + if (sendDms) member.send({ embeds: [errorEmbed] }) .then(() => verifyLogs.send(`${member} forgot to add their Discord to their profile. Let's hope they fix that with the message I just sent them.`)) .catch(() => { errorEmbed.setFooter("This message will be deleted in a minute") - verify.send(`${member} you had DMs disabled, so here's our message,`, errorEmbed) + verify.send({ content: `${member} you had DMs disabled, so here's our message,`, embeds: [errorEmbed] }) .then(msg => { setTimeout(() => { if (!msg.deleted) msg.delete() @@ -188,7 +188,7 @@ async function crowdinVerify(member: Discord.GuildMember, url?: string, sendDms: role.forEach(role => { if (role.role !== "Translator") { if (role.role !== "Manager") highestRole = role.role - if (highestRole == "manager" || highestRole == "owner") highestRole = "Manager" + if (highestRole === "manager" || highestRole === "owner") highestRole = "Manager" } }) highestProjectRoles[projectIDs[project.id].name] = highestRole @@ -260,13 +260,13 @@ async function crowdinVerify(member: Discord.GuildMember, url?: string, sendDms: }\nIf you wanna know more about all the projects we currently support, run \`+projects\` here.`) .setFooter("Any messages you send here will be sent to staff upon confirmation.") - if (sendDms) member.send(dmEmbed) - .then(() => verifyLogs.send(logEmbed)) + if (sendDms) member.send({ embeds: [dmEmbed] }) + .then(() => verifyLogs.send({ embeds: [logEmbed] })) .catch(() => { logEmbed.setFooter("Message not sent because user had DMs off") - verifyLogs.send(logEmbed) + verifyLogs.send({ embeds: [logEmbed] }) }) - else if (sendLogs) verifyLogs.send(logEmbed) + else if (sendLogs) verifyLogs.send({ embeds: [logEmbed] }) //#endregion } @@ -291,7 +291,7 @@ async function updateProjectRoles(projectName: ValidProjects, member: Discord.Gu role.forEach(role => { if (role.role !== "Translator") { if (role.role !== "Manager") highestRole = role.role - if (highestRole == "manager" || highestRole == "owner") highestRole = "Manager" + if (highestRole === "manager" || highestRole === "owner") highestRole = "Manager" } }) diff --git a/src/listeners/guildMemberAdd.ts b/src/listeners/guildMemberAdd.ts index 6fc85b98d10..f88ccfa3ea1 100644 --- a/src/listeners/guildMemberAdd.ts +++ b/src/listeners/guildMemberAdd.ts @@ -62,7 +62,7 @@ client.on("guildMemberAdd", member => { //OUTPUT const attachment = new Discord.MessageAttachment(canvas.toBuffer(), `${member.user.username} join.png`); - (member.guild.channels.cache.get("549882021934137354") as Discord.TextChannel).send(`${member.user} just joined. Welcome! 🎉`, attachment) //join-leave + (member.guild.channels.cache.get("549882021934137354") as Discord.TextChannel).send({ content: `${member.user} just joined. Welcome! 🎉`, files: [attachment] }) //join-leave }) }) if (!member.user.bot) { diff --git a/src/listeners/interaction.ts b/src/listeners/interaction.ts index e63580263e4..60084af0e57 100644 --- a/src/listeners/interaction.ts +++ b/src/listeners/interaction.ts @@ -14,8 +14,7 @@ client.on("interaction", async interaction => { executedBy = getString("executedBy", { user: interaction.user.tag }, "global") //Log if command is ran in DMs - if (interaction.channel?.type === "dm") - console.log(`${interaction.user.tag} used command ${interaction.commandName} in DMs`) + if (interaction.channel?.type === "dm") console.log(`${interaction.user.tag} used command ${interaction.commandName} in DMs`) //Return if user is not verified if (!member?.roles.cache.has("569194996964786178") && command.name !== "verify") return //Verified @@ -35,7 +34,7 @@ client.on("interaction", async interaction => { //Give perm to admins and return if not allowed if (!allowed) { - await interaction.reply(getString("errors.noAccess", "global"), { ephemeral: true }) + await interaction.reply({ content: getString("errors.noAccess", "global"), ephemeral: true }) return } @@ -46,7 +45,7 @@ client.on("interaction", async interaction => { .setAuthor(getString("error", "global")) .setTitle(getString("errors.dmError", "global")) .setFooter(executedBy, interaction.user.displayAvatarURL({ format: "png", dynamic: true })) - return interaction.reply(embed) + return interaction.reply({ embeds: [embed] }) } //Cooldown system if (!client.cooldowns.has(command.name)) client.cooldowns.set(command.name, new Discord.Collection()) @@ -60,8 +59,7 @@ client.on("interaction", async interaction => { let timeLeftS: string if (Math.ceil(timeLeft) >= 120) timeLeftS = getString("minsLeftT", { time: Math.ceil(timeLeft / 60), command: `/${interaction.commandName}` }, "global") - else if (Math.ceil(timeLeft) === 1) - timeLeftS = getString("secondLeft", { command: `/${interaction.commandName}` }, "global") + else if (Math.ceil(timeLeft) === 1) timeLeftS = getString("secondLeft", { command: `/${interaction.commandName}` }, "global") else timeLeftS = getString("timeLeftT", { time: Math.ceil(timeLeft), command: `/${interaction.commandName}` }, "global") const embed = new Discord.MessageEmbed() @@ -123,11 +121,7 @@ client.on("interaction", async interaction => { return } else { string = strings[pathPart] - if ( - !string || - (typeof string === "string" && - !isEqual(string.match(/%%\w+%%/g), enStrings[pathPart].match(/%%\w+%%/g))) - ) { + if (!string || (typeof string === "string" && !isEqual(string.match(/%%\w+%%/g), enStrings[pathPart].match(/%%\w+%%/g)))) { string = enStrings[pathPart] //if the string hasn't been added yet or if the variables changed if (!string) { string = null //in case of fire @@ -158,7 +152,8 @@ client.on("interaction", async interaction => { if (command.allowTip !== false && d <= 5) { // Less than or equal to 5% const keys = Object.keys(getString("tips", "global")) - const tip = getString(`tips.${keys[(keys.length * Math.random()) << 0]}`, + const tip = getString( + `tips.${keys[(keys.length * Math.random()) << 0]}`, { botUpdates: "<#732587569744838777>", gettingStarted: "<#699275092026458122>", @@ -183,15 +178,13 @@ client.on("interaction", async interaction => { .setTitle(error.toString().substring(0, 255)) .setDescription(`\`\`\`${error.stack.substring(0, 2047)}\`\`\``) .setFooter("Check the console for more details") - ; (interaction.client.channels.cache.get("730042612647723058") as Discord.TextChannel).send( - "<:aaaAAAAAAAAAAARGHGFGGHHHHHHHHHHH:831565459421659177> ERROR INCOMING, PLEASE FIX <@240875059953139714>", - embed - ) //Rodry and bot-development + ; (interaction.client.channels.cache.get("730042612647723058") as Discord.TextChannel).send({ + content: "<:aaaAAAAAAAAAAARGHGFGGHHHHHHHHHHH:831565459421659177> ERROR INCOMING, PLEASE FIX <@240875059953139714>", + embeds: [embed] + }) //Rodry and bot-development } console.error( - `Unexpected error with command ${interaction.commandName} on channel ${interaction.channel instanceof Discord.DMChannel - ? interaction.channel.type - : (interaction.channel as Discord.TextChannel).name + `Unexpected error with command ${interaction.commandName} on channel ${interaction.channel instanceof Discord.DMChannel ? interaction.channel.type : (interaction.channel as Discord.TextChannel).name } executed by ${interaction.user.tag}. Here's the error:\n${error.stack}` ) } diff --git a/src/listeners/message.ts b/src/listeners/message.ts index 7f36dcf6e2e..bc362e485da 100644 --- a/src/listeners/message.ts +++ b/src/listeners/message.ts @@ -84,7 +84,7 @@ client.on("message", async message => { `${getGlobalString("example", { url: "https://crowdin.com/translate/hypixel/286/en-en#106644" })} \n${getGlobalString("reminderLang", { format: "`crowdin.com/translate/hypixel/.../en-en#`" })}` ) - message.channel.send(`${message.author}`, embed) + message.channel.send({ content: `${message.author}`, embeds: [embed] }) return } else if (message.content !== langFix && message.channel.parentID === "549503328472530977") { message.react("732298639736570007") @@ -93,7 +93,7 @@ client.on("message", async message => { .setAuthor(getGlobalString("errors.wrongLink")) .setTitle(getGlobalString("linkCorrectionDesc", { format: "`crowdin.com/translate/hypixel/.../en-en#`" })) .setDescription(langFix) - message.channel.send(`${message.author}`, embed) + message.channel.send({ content: `${message.author}`, embeds: [embed] }) return } } @@ -125,7 +125,7 @@ client.on("message", async message => { .setDescription(message.content) .setFooter(getGlobalString("staffDm.confirmSend")) if (message.attachments.size > 0) embed.setTitle(`${getGlobalString("staffDm.confirmation")} ${getGlobalString("staffDm.attachmentsWarn")}`) - const msg = await message.channel.send(embed) + const msg = await message.channel.send({ embeds: [embed] }) await msg.react("✅") await msg.react("❎") const collector = msg.createReactionCollector( @@ -141,7 +141,7 @@ client.on("message", async message => { msg.reactions.cache.forEach(async reaction => await reaction.users.remove()) if (reaction.emoji.name === "❎") { embed.setColor(errorColor).setTitle(getGlobalString("staffDm.dmCancelled")).setFooter(getGlobalString("staffDm.resendInfo")) - msg.edit(embed) + msg.edit({ embeds: [embed] }) } else if (reaction.emoji.name === "✅") staffDm(msg, true) }) @@ -152,7 +152,7 @@ client.on("message", async message => { .setAuthor(getGlobalString("staffDm.dmCancelled")) .setDescription(message.content) .setFooter(getGlobalString("staffDm.resendInfo")) - msg.edit(timeOutEmbed) + msg.edit({ embeds: [timeOutEmbed] }) msg.reactions.cache.forEach(async reaction => await reaction.users.remove()) }) } else staffDm(message, false) @@ -174,21 +174,21 @@ client.on("message", async message => { message.attachments.forEach(file => images.push(file.attachment)) staffMsg.setTitle("View attachments") dmEmbed.setTitle(getGlobalString("staffDm.attachmentsSent")) - staffBots.send(`+dm ${message.author.id}`, { embed: staffMsg, files: images }) - message.channel.send(dmEmbed) + staffBots.send({ content: `+dm ${message.author.id}`, embeds: [staffMsg], files: images }) + message.channel.send({ embeds: [dmEmbed] }) return } else if (message.attachments.size > 0) { staffMsg .setTitle("View attachment") .setImage(message.attachments.first()!.url) dmEmbed.setTitle(getGlobalString("staffDm.attachmentSent")) - staffBots.send(`+dm ${message.author.id}`, staffMsg) - } else staffBots.send(`+dm ${message.author.id}`, staffMsg) //staff-bots + staffBots.send({ content: `+dm ${message.author.id}`, embeds: [staffMsg] }) + } else staffBots.send({ content: `+dm ${message.author.id}`, embeds: [staffMsg] }) //staff-bots if (afterConfirm) { - msg.edit(dmEmbed) + msg.edit({ embeds: [dmEmbed] }) return } - msg.channel.send(dmEmbed) + msg.channel.send({ embeds: [dmEmbed] }) } } diff --git a/src/listeners/messageReactionAdd.ts b/src/listeners/messageReactionAdd.ts index 24bfe5114b3..83d7e8e9806 100644 --- a/src/listeners/messageReactionAdd.ts +++ b/src/listeners/messageReactionAdd.ts @@ -36,7 +36,7 @@ client.on("messageReactionAdd", async (reaction, user) => { .setDescription(`${reaction.message}`) .addField(strings.message, `[${strings.clickHere}](${reaction.message.url})`) .setFooter(strings.requestedBy.replace("%%user%%", user.tag), user.displayAvatarURL({ dynamic: true, format: "png", })) - translatorChannel.send(`${reaction.message.author}`, embed) + translatorChannel.send({ content: `${reaction.message.author}`, embeds: [embed] }) } else if (reaction.emoji.name === "vote_no" && reaction.message.author!.id !== user.id) { reaction.message.react("⏱") const embed = new Discord.MessageEmbed() @@ -48,7 +48,7 @@ client.on("messageReactionAdd", async (reaction, user) => { setTimeout(async () => { // Check if the user hasn't removed their reaction if (await reaction.users.fetch().then(cache => cache.has(user.id))) { - translatorChannel.send(`${reaction.message.author}`, embed) + translatorChannel.send({ content: `${reaction.message.author}`, embeds: [embed] }) if (!reaction.message.deleted) reaction.message.delete() console.log(`String rejected in ${channel.name}`) } else reaction.message.reactions.cache.get("⏱")?.remove() @@ -85,7 +85,7 @@ client.on("messageReactionAdd", async (reaction, user) => { { name: "Quote number", value: `${id}` }, { name: "URL", value: reaction.message.url } ]) - reaction.message.channel.send(embed) + reaction.message.channel.send({ embeds: [embed] }) } } } diff --git a/src/listeners/ready.ts b/src/listeners/ready.ts index b33be3127e1..b04d1d702ba 100644 --- a/src/listeners/ready.ts +++ b/src/listeners/ready.ts @@ -4,7 +4,7 @@ import inactives from "../events/inactives" import crowdin from "../events/crowdinverify" import { listeningStatuses, watchingStatuses, playingStatuses } from "../config.json" import Discord from "discord.js" -import { isEqual } from "lodash" +import { isArray, isEqual, isObject, transform } from "lodash"; client.once("ready", async () => { console.log(`Logged in as ${client.user!.tag}!`) @@ -12,7 +12,8 @@ client.once("ready", async () => { const publishCommand = async (command: Command) => { if (command.allowDM) { //Create a global command - await client.application?.commands.create(convertToDiscordCommand(command)) + const cmd = await client.application!.commands.create(convertToDiscordCommand(command))! + await setPermissions(cmd) } else { //Create a guild wide command const cmd = await client.guilds.cache.get("549503328472530974")!.commands.create(convertToDiscordCommand(command)) @@ -25,23 +26,22 @@ client.once("ready", async () => { //TODO add check to delete commands that have been removed if (process.env.NODE_ENV === "dev") { const globalCommands = await client.application!.commands.fetch() - if (!globalCommands) - client.commands.filter(c => !!c.allowDM).forEach(async command => await publishCommand(command)) - else - client.commands.forEach(async (command: Command) => { - const discordCommand = globalCommands.find(c => c.name == command.name)! + client.commands.filter(c => !!c.allowDM).forEach(async command => { + if (!globalCommands) await publishCommand(command) + else { + const discordCommand = globalCommands.find(c => c.name === command.name)! //Chech if the command is published if (!globalCommands.some(cmd => cmd.name === command.name)) await publishCommand(command) else if (!commandEquals(discordCommand, command)) { + console.log(discordCommand.options, command.options?.map(o => transformOption(o))) discordCommand.edit(convertToDiscordCommand(command)) console.log(`Edited command ${command.name} since changes were found`) } - }) - const guildCommands = await client.guilds.cache.get("549503328472530974")!.commands.fetch() - if (!guildCommands) client.commands.filter(c => !c.allowDM).forEach(async command => await publishCommand(command)) - else client.guilds.cache.get("549503328472530974")!.commands.set(constructDiscordCommands()) - } else client.guilds.cache.get("549503328472530974")!.commands.set(constructDiscordCommands()) - .then(commands => commands.forEach(async command => await setPermissions(command))) + } + }) + } + //Set guild commands - these don't need checks since they update instantly + client.guilds.cache.get("549503328472530974")!.commands.set(constructDiscordCommands()) //Get server boosters and staff for the status let boostersStaff: string[] = [] @@ -89,7 +89,7 @@ client.once("ready", async () => { }, 60000) }) -const setPermissions = async (command: Discord.ApplicationCommand) => { +async function setPermissions(command: Discord.ApplicationCommand) { const permissions: Discord.ApplicationCommandPermissionData[] = [], clientCmd = client.commands.get(command.name)! clientCmd.roleWhitelist?.forEach(id => { @@ -110,7 +110,7 @@ const setPermissions = async (command: Discord.ApplicationCommand) => { }) if (permissions.length) await command.setPermissions(permissions) } -const constructDiscordCommands = () => { +function constructDiscordCommands() { const returnCommands: Discord.ApplicationCommandData[] = [] let clientCommands = client.commands if (process.env.NODE_ENV !== "dev") clientCommands = clientCommands.filter(cmd => !cmd.allowDM) @@ -119,7 +119,7 @@ const constructDiscordCommands = () => { return returnCommands } -const convertToDiscordCommand = (command: Command): Discord.ApplicationCommandData => { +function convertToDiscordCommand(command: Command): Discord.ApplicationCommandData { return { name: command.name, description: command.description, @@ -131,4 +131,15 @@ const convertToDiscordCommand = (command: Command): Discord.ApplicationCommandDa const commandEquals = (discordCommand: Discord.ApplicationCommand, localCommand: Command) => discordCommand.name === localCommand.name && discordCommand.description === localCommand.description && - isEqual(discordCommand.options, localCommand.options) + isEqual(discordCommand.options, localCommand.options?.map(o => transformOption(o)) ?? []) + +function transformOption(option: Discord.ApplicationCommandOptionData): Discord.ApplicationCommandOptionData { + return { + type: option.type, + name: option.name, + description: option.description, + required: option.required ? true : undefined, + choices: option.choices, + options: option.options?.map(o => transformOption(o)), + } +} \ No newline at end of file diff --git a/src/listeners/voiceStateUpdate.ts b/src/listeners/voiceStateUpdate.ts index 6bcc5913813..a7f7cc3ac59 100644 --- a/src/listeners/voiceStateUpdate.ts +++ b/src/listeners/voiceStateUpdate.ts @@ -18,7 +18,7 @@ client.on("voiceStateUpdate", (oldState, newState) => { .setDescription(`**${newState.member} was server ${newState.serverMute ? "muted" : "unmuted"} in ${newState.channel?.name}**`) .setFooter(`ID: ${newState.member!.id}`) .setTimestamp(Date.now()) - logs.send(embed) + logs.send({ embeds: [embed] }) } else if (!!oldState.serverDeaf != !!newState.serverDeaf) { const embed = new Discord.MessageEmbed() .setColor(newState.serverDeaf ? errorColor : successColor) @@ -26,7 +26,7 @@ client.on("voiceStateUpdate", (oldState, newState) => { .setDescription(`**${newState.member} was server ${newState.serverDeaf ? "deafened" : "undeafened"} in ${newState.channel?.name}**`) .setFooter(`ID: ${newState.member!.id}`) .setTimestamp(Date.now()) - logs.send(embed) + logs.send({ embeds: [embed] }) } } }) \ No newline at end of file