From 0cdd107b920a53ba488a6b7e3ce913bccd74219a Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Wed, 24 Aug 2022 23:23:44 -0700 Subject: [PATCH] upgrade to discord.js v14 --- commands/311.js | 110 ++-- commands/911.js | 110 ++-- commands/bank.js | 284 ++++----- commands/fine.js | 59 +- commands/help.js | 88 +-- commands/inventory.js | 391 ++++++------- commands/me.js | 28 +- commands/money.js | 117 ++-- commands/ping.js | 8 +- commands/search.js | 64 +- commands/settings.js | 1033 +++++++++++++++++---------------- commands/stats.js | 8 +- commands/tweet.js | 26 +- commands/wallet.js | 91 +-- commands/work-roles.js | 12 +- commands/work.js | 45 +- config/config.js | 7 +- index.js | 4 +- package-lock.json | 563 +++++++++--------- package.json | 3 +- structures/QuarksBot.js | 39 +- structures/inventory.js | 1 + util/Logger.js | 16 + util/RegisterSlashCommands.js | 51 +- 24 files changed, 1598 insertions(+), 1560 deletions(-) diff --git a/commands/311.js b/commands/311.js index f541408..d5ed157 100644 --- a/commands/311.js +++ b/commands/311.js @@ -1,4 +1,4 @@ -const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js'); +const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); module.exports = { name: "311", @@ -9,41 +9,41 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [ + { + name: "name", + description: "Caller name", + value: "name", + type: 3, + required: true + }, + { + name: "service", + description: "What emergency service you require", + value: "service", + type: 3, + required: true, + choices: [ + { name: "Fire Dept.", value: "Fire Dept." }, { name: "Law Enforcement", value: "Law Enforcement" }, + { name: "EMS (Medical)", value: "EMS" }, { name: "All Dept.", value: "All Dept." } + ] + }, + { + name: "location", + description: "The location of your emergency", + value: "location", + type: 3, + required: true, + }, + { + name: "nature", + description: "The nature fo your emergency", + value: "nature", + type: 3, + required: true, + } + ], SlashCommand: { - options: [ - { - name: "name", - description: "Caller name", - value: "name", - type: 3, - required: true - }, - { - name: "service", - description: "What emergency service you require", - value: "service", - type: 3, - required: true, - choices: [ - { name: "Fire Dept.", value: "Fire Dept." }, { name: "Law Enforcement", value: "Law Enforcement" }, - { name: "EMS (Medical)", value: "EMS" }, { name: "All Dept.", value: "All Dept." } - ] - }, - { - name: "location", - description: "The location of your emergency", - value: "location", - type: 3, - required: true, - }, - { - name: "nature", - description: "The nature fo your emergency", - value: "nature", - type: 3, - required: true, - } - ], /** * * @param {require("../structures/QuarksBot")} client @@ -73,8 +73,8 @@ module.exports = { ? '1. `dispatcher_role`\n2. `dispatcher_channel`' : 'Error'; - const errorEmbed = new MessageEmbed() - .setColor("RED") + const errorEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Red) .setTitle("Notice:") .setDescription(`An admin needs to configure the following:\n${configure}`) @@ -85,24 +85,24 @@ module.exports = { let status = 'Open'; let Description = `**Call ID** ${ID}\n\n**Caller** ${args[0].value}\n**Service** ${args[1].value}\n**Location** ${args[2].value}\n**Nature** ${args[0].value}\n\n**Status**\n\`\`\`diff\n${status=='Open'?'+':'-'} ${status}\`\`\`` - let embed311 = new MessageEmbed() - .setColor(client.config.EmbedColor) + let embed311 = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle('311 Call Alert') .setTimestamp() .setDescription(Description) - let opt = new MessageActionRow() + let opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`close-${GuildDB.dispatcherRole}`) .setLabel("Close") - .setStyle("PRIMARY"), + .setStyle(ButtonStyle.Primary), ) .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`delete-${GuildDB.dispatcherRole}`) .setLabel("Delete") - .setStyle("DANGER"), + .setStyle(ButtonStyle.Danger), ) client.on("interactionCreate", ButtonInteraction => { @@ -111,7 +111,7 @@ module.exports = { if (!ButtonInteraction.member._roles.includes(GuildDB.dispatcherRole)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } if (queryString.startsWith('close')) { @@ -122,28 +122,28 @@ module.exports = { status = 'Open'; Description = `**Call ID** ${ID}\n\n**Caller** ${args[0].value}\n**Service** ${args[1].value}\n**Location** ${args[2].value}\n**Nature** ${args[0].value}\n\n**Status**\n\`\`\`diff\n${status=='Open'?'+':'-'} ${status}\`\`\`` } else if (queryString.startsWith('delete')) { - const closedEmbed = new MessageEmbed().setTitle('Deleted Call').setColor(client.config.EmbedColor); + const closedEmbed = new EmbedBuilder().setTitle('Deleted Call').setColor(client.config.Colors.Default); return ButtonInteraction.update({ embeds: [closedEmbed], components: [] }); } - embed311 = new MessageEmbed() - .setColor(client.config.EmbedColor) + embed311 = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle('311 Call Alert') .setTimestamp() .setDescription(Description) - opt = new MessageActionRow() + opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`${queryString.startsWith('close')?'Open':'Close'}-${GuildDB.dispatcherRole}`) .setLabel(queryString.startsWith('close')?'Open':'Close') - .setStyle("PRIMARY"), + .setStyle(ButtonStyle.Primary), ) .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`delete-${GuildDB.dispatcherRole}`) .setLabel("Delete") - .setStyle("DANGER"), + .setStyle(ButtonStyle.Danger), ) return ButtonInteraction.update({ embeds: [embed311], components: [opt] }); @@ -151,9 +151,9 @@ module.exports = { const channel = interaction.guild.channels.cache.find(channel => channel.id === GuildDB.dispatchChannel); if (!channel) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nThe channel may have been deleted\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } diff --git a/commands/911.js b/commands/911.js index d4333a8..a2c32bd 100644 --- a/commands/911.js +++ b/commands/911.js @@ -1,4 +1,4 @@ -const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js'); +const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); module.exports = { name: "911", @@ -9,41 +9,41 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [ + { + name: "name", + description: "Caller name", + value: "name", + type: 3, + required: true + }, + { + name: "service", + description: "What emergency service you require", + value: "service", + type: 3, + required: true, + choices: [ + { name: "Fire Dept.", value: "Fire Dept." }, { name: "Law Enforcement", value: "Law Enforcement" }, + { name: "EMS (Medical)", value: "EMS" }, { name: "All Dept.", value: "All Dept." } + ] + }, + { + name: "location", + description: "The location of your emergency", + value: "location", + type: 3, + required: true, + }, + { + name: "nature", + description: "The nature fo your emergency", + value: "nature", + type: 3, + required: true, + } + ], SlashCommand: { - options: [ - { - name: "name", - description: "Caller name", - value: "name", - type: 3, - required: true - }, - { - name: "service", - description: "What emergency service you require", - value: "service", - type: 3, - required: true, - choices: [ - { name: "Fire Dept.", value: "Fire Dept." }, { name: "Law Enforcement", value: "Law Enforcement" }, - { name: "EMS (Medical)", value: "EMS" }, { name: "All Dept.", value: "All Dept." } - ] - }, - { - name: "location", - description: "The location of your emergency", - value: "location", - type: 3, - required: true, - }, - { - name: "nature", - description: "The nature fo your emergency", - value: "nature", - type: 3, - required: true, - } - ], /** * * @param {require("../structures/QuarksBot")} client @@ -73,8 +73,8 @@ module.exports = { ? '1. `dispatcher_role`\n2. `dispatcher_channel`' : 'Error'; - const errorEmbed = new MessageEmbed() - .setColor("RED") + const errorEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Red) .setTitle("Notice:") .setDescription(`An admin needs to configure the following:\n${configure}`) @@ -85,24 +85,24 @@ module.exports = { let status = 'Open'; let Description = `**Call ID** ${ID}\n\n**Caller** ${args[0].value}\n**Service** ${args[1].value}\n**Location** ${args[2].value}\n**Nature** ${args[0].value}\n\n**Status**\n\`\`\`diff\n${status=='Open'?'+':'-'} ${status}\`\`\`` - let embed911 = new MessageEmbed() - .setColor(client.config.EmbedColor) + let embed911 = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle('911 Call Alert') .setTimestamp() .setDescription(Description) - let opt = new MessageActionRow() + let opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`close-${GuildDB.dispatcherRole}`) .setLabel("Close") - .setStyle("PRIMARY"), + .setStyle(ButtonStyle.Primary), ) .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`delete-${GuildDB.dispatcherRole}`) .setLabel("Delete") - .setStyle("DANGER"), + .setStyle(ButtonStyle.Danger), ) client.on("interactionCreate", ButtonInteraction => { @@ -111,7 +111,7 @@ module.exports = { if (!ButtonInteraction.member._roles.includes(GuildDB.dispatcherRole)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } if (queryString.startsWith('close')) { @@ -122,28 +122,28 @@ module.exports = { status = 'Open'; Description = `**Call ID** ${ID}\n\n**Caller** ${args[0].value}\n**Service** ${args[1].value}\n**Location** ${args[2].value}\n**Nature** ${args[0].value}\n\n**Status**\n\`\`\`diff\n${status=='Open'?'+':'-'} ${status}\`\`\`` } else if (queryString.startsWith('delete')) { - const closedEmbed = new MessageEmbed().setTitle('Deleted Call').setColor(client.config.EmbedColor); + const closedEmbed = new EmbedBuilder().setTitle('Deleted Call').setColor(client.config.Colors.Default); return ButtonInteraction.update({ embeds: [closedEmbed], components: [] }); } - embed911 = new MessageEmbed() - .setColor(client.config.EmbedColor) + embed911 = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle('911 Call Alert') .setTimestamp() .setDescription(Description) - opt = new MessageActionRow() + opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`${queryString.startsWith('close')?'Open':'Close'}-${GuildDB.dispatcherRole}`) .setLabel(queryString.startsWith('close')?'Open':'Close') - .setStyle("PRIMARY"), + .setStyle(ButtonStyle.Primary), ) .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`delete-${GuildDB.dispatcherRole}`) .setLabel("Delete") - .setStyle("DANGER"), + .setStyle(ButtonStyle.Danger), ) return ButtonInteraction.update({ embeds: [embed911], components: [opt] }); @@ -151,9 +151,9 @@ module.exports = { const channel = interaction.guild.channels.cache.find(channel => channel.id === GuildDB.dispatchChannel); if (!channel) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nThe channel may have been deleted\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } diff --git a/commands/bank.js b/commands/bank.js index 3d0fa18..d4fca7c 100644 --- a/commands/bank.js +++ b/commands/bank.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const { Bank, addBank } = require('../structures/bank'); const { Inventory, addInventory } = require('../structures/inventory'); @@ -6,99 +6,101 @@ module.exports = { name: "bank", debug: false, description: "Manage your banking", - usage: "[cmd] [opt], ephemeral: true", + usage: "[cmd] [opt], flags: (1 << 6)", permissions: { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, - SlashCommand: { - options: [ - { - name: "deposit", - description: "Deposit cash into your bank", - value: "deposit", - type: 1, - options: [{ - name: "amount", - description: "Amount to deposit", - value: "amount", - type: 10, - min_value: 0.01, - required: true, - }] - }, - { - name: "withdraw", - description: "Withdraw cash from you bank", - value: "deposit", - type: 1, - options: [{ - name: "amount", - description: "Amount to withdraw", - value: "amount", - type: 10, - min_value: 0.01, - required: true, - }] - }, - { - name: "balance", - description: "View your bank balance and count your cash", - value: "balance", - type: 1, - options: [{ + options: [ + { + name: "deposit", + description: "Deposit cash into your bank", + value: "deposit", + type: 1, + options: [{ + name: "amount", + description: "Amount to deposit", + value: "amount", + type: 5, + min_value: 0.01, + required: true, + }] + }, + { + name: "withdraw", + description: "Withdraw cash from you bank", + value: "deposit", + type: 1, + options: [{ + name: "amount", + description: "Amount to withdraw", + value: "amount", + type: 5, + min_value: 0.01, + required: true, + }] + }, + { + name: "balance", + description: "View your bank balance and count your cash", + value: "balance", + type: 1, + options: [{ + name: "user", + description: "User to view ballance", + value: "user", + type: 6, + required: false, + }] + }, + { + name: "give", + description: "Give a user cash", + value: "give", + type: 1, + options: [ + { name: "user", - description: "User to view ballance", + description: "User to give cash to", value: "user", type: 6, - required: false, - }] - }, - { - name: "give", - description: "Give a user cash", - value: "give", - type: 1, - options: [ - { - name: "user", - description: "User to give cash to", - value: "user", - type: 6, - required: true, - }, - { - name: "amount", - description: "The amount to give", - value: 1, - type: 10, - required: true, - }, - ] - }, - { - name: "transfer", - description: "Transfer directly to users bank", - value: "transfer", - type: 1, - options: [ - { - name: "user", - description: "User to transfer to", - value: "user", - type: 6, - required: true, - }, - { - name: "amount", - description: "The amount to transfer", - value: 1, - type: 10, - required: true, - }, - ] - } - ], + required: true, + }, + { + name: "amount", + description: "The amount to give", + value: "amount", + type: 5, + min_value: 0.01, + required: true, + }, + ] + }, + { + name: "transfer", + description: "Transfer directly to users bank", + value: "transfer", + type: 1, + options: [ + { + name: "user", + description: "User to transfer to", + value: "user", + type: 6, + required: true, + }, + { + name: "amount", + description: "The amount to transfer", + value: "amount", + type: 5, + min_value: 0.01, + required: true, + }, + ] + } + ], + SlashCommand: { /** * * @param {require("../structures/QuarksBot")} client @@ -133,9 +135,9 @@ module.exports = { .catch(err => { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -147,9 +149,9 @@ module.exports = { const success = addBank(banking.guilds, GuildDB.serverID, interaction.member.user.id, client, GuildDB.startingBalance); if (!success) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -165,9 +167,9 @@ module.exports = { .catch(err => { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -178,9 +180,9 @@ module.exports = { const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client); if (!success) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -188,9 +190,9 @@ module.exports = { if (args[0].name == 'deposit') { if (banking.guilds[GuildDB.serverID].account.cash.toFixed(2) - args[0].options[0].value < 0) { - const nsf = new MessageEmbed() + const nsf = new EmbedBuilder() .setDescription('**Bank Notice:** NSF. Non sufficient funds') - .setColor("RED"); + .setColor(client.config.Colors.Red); return interaction.send({ embeds: [nsf] }); } @@ -201,9 +203,9 @@ module.exports = { client.dbo.collection("banks").updateOne({"account.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance,[`banking.guilds.${GuildDB.serverID}.account.cash`]:newCash}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -212,15 +214,15 @@ module.exports = { {$set:{[`inventory.guilds.${GuildDB.serverID}.items.$.cash`]:newCash}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const successEmbed = new MessageEmbed() + const successEmbed = new EmbedBuilder() .setTitle('Bank Notice:') .setDescription(`Successfully deposited **$${args[0].options[0].value.toFixed(2)}**\nUse \`/bank balance\` to view your balance`) .setColor('GREEN'); @@ -229,9 +231,9 @@ module.exports = { } else if (args[0].name == 'withdraw') { if (args[0].options[0].value > banking.guilds[GuildDB.serverID].account.balance) { - let nsf = new MessageEmbed() + let nsf = new EmbedBuilder() .setDescription('**Bank Notice:** NSF. Non sufficient funds') - .setColor("RED"); + .setColor(client.config.Colors.Red); return interaction.send({ embeds: [nsf] }); } @@ -242,9 +244,9 @@ module.exports = { client.dbo.collection("banks").updateOne({"account.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance,[`banking.guilds.${GuildDB.serverID}.account.cash`]:newCash}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -253,15 +255,15 @@ module.exports = { {$set:{[`inventory.guilds.${GuildDB.serverID}.items.$.cash`]:newCash}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const successEmbed = new MessageEmbed() + const successEmbed = new EmbedBuilder() .setTitle('Bank Notice:') .setDescription(`Successfully withdrew **$${args[0].options[0].value.toFixed(2)}**\nUse \`/bank balance\` or \`/inventory wallet\` to view your cash balance`) .setColor('GREEN'); @@ -269,8 +271,8 @@ module.exports = { return interaction.send({ embeds: [successEmbed] }); } else if (args[0].name == 'balance') { - let balanceEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor); + let balanceEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Default); if (args[0].options&&args[0].options[0]) { // Show target users balance @@ -298,9 +300,9 @@ module.exports = { .catch(err => { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -312,9 +314,9 @@ module.exports = { const success = addBank(targetUserBanking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance); if (!success) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -344,9 +346,9 @@ module.exports = { // send money from wallet if (banking.guilds[GuildDB.serverID].account.cash.toFixed(2) - args[0].options[1].value < 0) { - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setTitle('Non sufficient funds! Withdraw more cash') - .setColor("RED"); + .setColor(client.config.Colors.Red); return interaction.send({ embeds: [embed] }); } @@ -356,9 +358,9 @@ module.exports = { client.dbo.collection("banks").updateOne({"account.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.cash`]:newCash}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -368,9 +370,9 @@ module.exports = { {$set:{[`inventory.guilds.${GuildDB.serverID}.items.$.cash`]:newCash}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -388,9 +390,9 @@ module.exports = { .catch(err => { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -401,9 +403,9 @@ module.exports = { const success = addInventory(targetUserInventory.guilds, GuildDB.serverID, targetUserID, client); if (!success) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -414,9 +416,9 @@ module.exports = { {$set:{[`inventory.guilds.${GuildDB.serverID}.items.$.cash`]:newTargetCash}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -437,9 +439,9 @@ module.exports = { client.dbo.collection("banks").insertOne(targetUserBanking, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -450,16 +452,16 @@ module.exports = { client.dbo.collection("banks").updateOne({"account.userID": targetUserID}, {$set: {[`banking.guilds.${GuildDB.serverID}.account.cash`]: newTargetCash}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } - const successEmbed = new MessageEmbed() + const successEmbed = new EmbedBuilder() .setTitle('Success') .setDescription(`Successfully gave <@${targetUserID}> $${args[0].options[1].value.toFixed(2)}`) .setColor('GREEN'); @@ -470,9 +472,9 @@ module.exports = { // send money from bank if (banking.guilds[GuildDB.serverID].account.balance.toFixed(2) - args[0].options[1].value < 0) { - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setTitle('Non sufficient funds! Withdraw more cash') - .setColor("RED"); + .setColor(client.config.Colors.Red); return interaction.send({ embeds: [embed] }); } @@ -482,9 +484,9 @@ module.exports = { client.dbo.collection("banks").updateOne({"account.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -505,9 +507,9 @@ module.exports = { client.dbo.collection("banks").insertOne(targetUserBanking, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -518,16 +520,16 @@ module.exports = { client.dbo.collection("banks").updateOne({"account.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newTargetBalance}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } - const successEmbed = new MessageEmbed() + const successEmbed = new EmbedBuilder() .setTitle('Bank Notice:') .setDescription(`Successfully transfered <@${targetUserID}> $${args[0].options[1].value.toFixed(2)}`) .setColor('GREEN'); diff --git a/commands/fine.js b/commands/fine.js index f019ef4..e8c3997 100644 --- a/commands/fine.js +++ b/commands/fine.js @@ -1,4 +1,5 @@ -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); +const { Bank, addBank } = require('../structures/bank'); module.exports = { name: "fine", @@ -9,24 +10,24 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [ + { + name: "user", + description: "The user to fine", + value: "user", + type: 6, + required: true, + }, + { + name: "amount", + description: "Amount the fine totals to", + value: "amount", + type: 5, + min_value: 0.01, + required: true, + } + ], SlashCommand: { - options: [ - { - name: "user", - description: "The user to fine", - value: "user", - type: 6, - required: true, - }, - { - name: "amount", - description: "Amount the fine totals to", - value: "amount", - type: 10, - min_value: 0.01, - required: true, - } - ], /** * * @param {require("../structures/QuarksBot")} client @@ -40,16 +41,16 @@ module.exports = { } if (!GuildDB.officerRole) { - const embed = MessageEmbed() - .setColor("RED") + const embed = EmbedBuilder() + .setColor(client.config.Colors.Red) .setDescription("**Notice:** The admins have not set an officer role.") return interaction.send({ embeds: [embed] }); } if (!interaction.member.roles.includes(GuildDB.officerRole)) { - const embed = MessageEmbed() - .setColor("RED") + const embed = EmbedBuilder() + .setColor(client.config.Colors.Red) .setDescription(`**Notice: You require the <@&${GuildDB.officerRole}>**`) return interaction.send({ embeds: [embed] }); @@ -78,9 +79,9 @@ module.exports = { .catch(err => { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -92,9 +93,9 @@ module.exports = { const success = addBank(banking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance); if (!success) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -105,15 +106,15 @@ module.exports = { client.dbo.collection("banks").updateOne({"account.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newTargetBalance}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const successEmbed = new MessageEmbed() + const successEmbed = new EmbedBuilder() .setTitle('Bank Notice:') .setDescription(`Successfully fined <@${targetUserID}> $${args[0].options[1].value.toFixed(2)}`) .setColor('GREEN'); diff --git a/commands/help.js b/commands/help.js index 212fd00..ecb7b06 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "help", @@ -9,40 +9,40 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [ + { + name: "commands", + description: "List all commands", + value: "commands", + type: 1, + options: [{ + name: "command", + description: "Get information on a specific command", + value: "command", + type: 3, + required: false, + }] + }, + { + name: "settings", + description: "How to configure the settings", + value: "settings", + type: 1, + }, + { + name: "support", + description: "Get support for QuarksBot", + value: "support", + type: 1, + }, + { + name: "credits", + description: "QuarksBot Credits", + value: "credits", + type: 1, + } + ], SlashCommand: { - options: [ - { - name: "commands", - description: "List all commands", - value: "commands", - type: 1, - options: [{ - name: "command", - description: "Get information on a specific command", - value: "command", - type: 3, - required: false, - }] - }, - { - name: "settings", - description: "How to configure the settings", - value: "settings", - type: 1, - }, - { - name: "support", - description: "Get support for QuarksBot", - value: "support", - type: 1, - }, - { - name: "credits", - description: "QuarksBot Credits", - value: "credits", - type: 1, - } - ], /** * * @param {require("../structures/QuarksBot")} client @@ -62,8 +62,8 @@ module.exports = { `\`/${cmd.name}${cmd.usage ? " " + cmd.usage : ""}\` - ${cmd.description}` ); - let Embed = new MessageEmbed() - .setColor(client.config.EmbedColor) + let Embed = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setDescription(`${Commands.join("\n")} QuarksBot Version: v${client.config.Version}`); @@ -80,9 +80,9 @@ module.exports = { `āŒ | Unable to find that command.` ); - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setDescription(cmd.description) - .setColor("GREEN") + .setColor(client.config.Colors.Green) .setTitle(`How to use /${cmd.name} command`) if (cmd.SlashCommand.options && cmd.SlashCommand.options[0].type == 1) { @@ -112,8 +112,8 @@ module.exports = { return interaction.send(embed); } } else if (args[0].name == 'settings') { - const settingsHelp = new MessageEmbed() - .setColor(client.config.EmbedColor) + const settingsHelp = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle('Using settings command to configure your guild') .setDescription(`Some features of QuarksBot require, or recommend settings. @@ -165,8 +165,8 @@ module.exports = { return interaction.send({ embeds: [settingsHelp] }); } else if (args[0].name == 'support') { - const supportEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor) + const supportEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setDescription(`**__QuarksBot Support__** Are you experiencing troubles with QuarksBot? @@ -181,8 +181,8 @@ module.exports = { return interaction.send({ embeds: [supportEmbed] }); } else if (args[0].name == 'credits') { - const creditsEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor) + const creditsEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle('QuarksBot Credits') .setDescription(` **Bot Author:** McDazzzled#5307 diff --git a/commands/inventory.js b/commands/inventory.js index 4d6464a..eb9b58c 100644 --- a/commands/inventory.js +++ b/commands/inventory.js @@ -1,4 +1,4 @@ -const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js'); +const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); const { Inventory, addInventory } = require('../structures/inventory'); const action = ['ditch', 'drop', 'forget', 'throw out', 'leave', 'set down', 'let go of']; @@ -12,157 +12,142 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [ + { + name: "view", + description: "View your inventory", + value: "view", + type: 1, + }, + { + name: "wallet", + description: "View your wallet", + value: "wallet", + type: 1, + }, + { + name: "add", + description: "Add item to inventory", + value: "add", + type: 2, + options: [ + { + name: "firearm", + description: "Add firearm to inventory", + value: "firearm", + type: 1, + options: [ + { + name: "type", + description: "Type of firearm", + value: "type", + type: 3, + required: true, + choices: [ + { name: 'Pistol', value: 'Pistol' }, { name: 'Revolver', value: 'Revolver' }, { name: 'Shotgun', value: 'Shotgun' }, + { name: 'Submachine Gun', value: 'Submachine Gun' }, { name: 'Light Machine Gun', value: 'Ligh Machine Gun' }, + { name: 'Assault Rifle', value: 'Assault Rifle' }, { name: 'Sniper Rifle', value: 'Sniper Rifle' }, + ] + }, + { + name: "serialnumber", + description: "Firearm serial number", + value: "serialnumber", + type: 3, + required: true, + }, + { + name: "owner", + description: "Firearm Owner's Full Name", + value: "owner", + type: 3, + required: true, + }, + { + name: "description", + description: "Firearm description", + value: "description", + type: 3, + required: true, + } + ] + }, + { + name: "generic", + description: "Add a generic item to inventory", + value: "generic", + type: 1, + options: [ + { + name: "name", + description: "Item name", + value: "name", + type: 3, + required: true, + }, + { + name: "description", + description: "Item description", + value: "description", + type: 3, + required: true, + }, + { + name: "quantity", + description: "The number of this item", + value: "quantity", + type: 4, + required: true, + } + ] + } + ] + }, + { + name: "give", + description: "Give user item from inventory", + value: "give", + type: 1, + options: [ + { + name: "item-number", + description: "Item to interact with", + value: 1, + type: 4, + required: true, + }, + { + name: "user", + description: "User to give item", + value: "user", + type: 6, + required: true, + } + ], + }, + { + name: "drop", + description: "Drop item from inventory", + value: "drop", + type: 1, + options: [ + { + name: "item-number", + description: "Item to interact with", + value: 1, + type: 4, + required: true, + } + ], + }, + { + name: "clear", + description: "Clear your inventory", + value: "clear", + type: 1, + } + ], SlashCommand: { - options: [ - { - name: "view", - description: "View your inventory", - value: "view", - type: 1, - }, - { - name: "wallet", - description: "View your wallet", - value: "wallet", - type: 1, - }, - { - name: "item", - description: "View an item in your inventory", - value: "item", - type: 1, - options: [ - { - name: "item-number", - description: "Item to interact with", - value: 1, - type: 4, - required: true, - }, - ], - }, - { - name: "add", - description: "Add item to inventory", - value: "add", - type: 2, - options: [ - { - name: "firearm", - description: "Add firearm to inventory", - value: "firearm", - type: 1, - options: [ - { - name: "type", - description: "Type of firearm", - value: "type", - type: 3, - required: true, - choices: [ - { name: 'Pistol', value: 'Pistol' }, { name: 'Revolver', value: 'Revolver' }, { name: 'Shotgun', value: 'Shotgun' }, - { name: 'Submachine Gun', value: 'Submachine Gun' }, { name: 'Light Machine Gun', value: 'Ligh Machine Gun' }, - { name: 'Assault Rifle', value: 'Assault Rifle' }, { name: 'Sniper Rifle', value: 'Sniper Rifle' }, - ] - }, - { - name: "serialnumber", - description: "Firearm serial number", - value: "serialnumber", - type: 3, - required: true, - }, - { - name: "owner", - description: "Firearm Owner's Full Name", - value: "owner", - type: 3, - required: true, - }, - { - name: "description", - description: "Firearm description", - value: "description", - type: 3, - required: true, - } - ] - }, - { - name: "generic", - description: "Add a generic item to inventory", - value: "generic", - type: 1, - options: [ - { - name: "name", - description: "Item name", - value: "name", - type: 3, - required: true, - }, - { - name: "description", - description: "Item description", - value: "description", - type: 3, - required: true, - }, - { - name: "quantity", - description: "The number of this item", - value: "quantity", - type: 4, - required: true, - } - ] - } - ] - }, - { - name: "give", - description: "Give user item from inventory", - value: "give", - type: 1, - options: [ - { - name: "item-number", - description: "Item to interact with", - value: 1, - type: 4, - required: true, - }, - { - name: "user", - description: "User to give item", - value: "user", - type: 6, - required: true, - } - ], - }, - { - name: "drop", - description: "Drop item from inventory", - value: "drop", - type: 1, - options: [ - { - name: "item-number", - description: "Item to interact with", - value: 1, - type: 4, - required: true, - } - ], - }, - { - name: "clear", - description: "Clear your inventory", - value: "clear", - type: 1, - } - ], /** * * @param {require("../structures/QuarksBot")} client @@ -204,9 +189,9 @@ module.exports = { .catch(err => { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -217,9 +202,9 @@ module.exports = { const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client); if (!success) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -228,8 +213,8 @@ module.exports = { if (args[0].name == 'view') { // Display Inventory - let inventoryEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor) + let inventoryEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle('Your Inventory') let description = `To see detials on an Item use \`/inventory item [item number]\`\n\n\`\`\`` @@ -241,7 +226,7 @@ module.exports = { inventoryEmbed.setDescription(description); - return interaction.send({ embeds: [inventoryEmbed], ephemeral: true }); + return interaction.send({ embeds: [inventoryEmbed], flags: (1 << 6) }); } else if (args[0].name == 'wallet') { // Display wallet @@ -249,9 +234,9 @@ module.exports = { let item = inventory.guilds[GuildDB.serverID].items[0]; let ID = `${client.exists(item.ID.firstname) ? item.ID.firstname : '...'} ${client.exists(item.ID.lastname) ? item.ID.lastname : '...'} | ${client.exists(item.ID.dob) ? item.ID.dob : 'N/A'} | ${client.exists(item.ID.addr) ? item.ID.addr : 'N/A'}` - let walletEmbed = new MessageEmbed() + let walletEmbed = new EmbedBuilder() .setTitle(`Your Wallet`) - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) .addFields( { name: '**Cash**', value: `$${item.cash.toFixed(2)}`, inline: true }, { name: '**ID**', value: ID, inline: true }); @@ -262,15 +247,15 @@ module.exports = { // Display Item Data if (args[0].options[0].value < 1 || args[0].options[0].value > inventory.guilds[GuildDB.serverID].items.length) { - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setTitle("Please provide a valid item number") - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } let item = inventory.guilds[GuildDB.serverID].items[args[0].options[0].value-1]; - let itemEmbed = new MessageEmbed().setColor(client.config.EmbedColor); + let itemEmbed = new EmbedBuilder().setColor(client.config.Colors.Default); if (item.type == 'wallet') { // Display wallet @@ -317,17 +302,17 @@ module.exports = { client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$push: {[`inventory.guilds.${GuildDB.serverID}.items`]: firearm}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - let message = new MessageEmbed() + let message = new EmbedBuilder() .setTitle(`You ${actions[Math.floor(Math.random() * actions.length)]} a ${firearm.weaponType}`) - .setColor(client.config.EmbedColor); + .setColor(client.config.Colors.Default); return interaction.send({ embeds: [message] }); @@ -344,17 +329,17 @@ module.exports = { client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$push: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - let message = new MessageEmbed() + let message = new EmbedBuilder() .setTitle(`You ${actions[Math.floor(Math.random() * actions.length)]} a ${item.name}`) - .setColor(client.config.EmbedColor); + .setColor(client.config.Colors.Default); return interaction.send({ embeds: [message] }); } @@ -363,17 +348,17 @@ module.exports = { // Remove Item from inventory if (args[0].options[0].value < 1 || args[0].options[0].value > inventory.guilds[GuildDB.serverID].items.length) { - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setTitle("Please provide a valid item number") - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } if (args[0].options[0].value == 1) { - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setTitle("Cannot Drop Wallet") - .setColor(client.config.EmbedColor); + .setColor(client.config.Colors.Default); return interaction.send({ embeds: [embed] }); } @@ -383,16 +368,16 @@ module.exports = { client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } - let message = new MessageEmbed() + let message = new EmbedBuilder() .setTitle(`You ${action[Math.floor(Math.random() * actions.length)]} your ${item.name}`) - .setColor(client.config.EmbedColor); + .setColor(client.config.Colors.Default); return interaction.send({ embeds: [message] }); }); @@ -401,18 +386,18 @@ module.exports = { // Give user Item from inventory if (args[0].options[0].value < 1 || args[0].options[0].value > inventory.guilds[GuildDB.serverID].items.length) { - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setTitle("Please provide a valid item number") - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } let item = inventory.guilds[GuildDB.serverID].items[args[0].options[0].value-1]; if (item.type == 'wallet') { - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setTitle("Cannot Give Wallet") - .setColor("RED"); + .setColor(client.config.Colors.Red); return interaction.send({ embeds: [embed] }); } @@ -428,9 +413,9 @@ module.exports = { .catch(err => { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -439,9 +424,9 @@ module.exports = { client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -449,16 +434,16 @@ module.exports = { client.dbo.collection('inventories').updateOne({'inventory.userID': targetUserID}, {$push: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } - let successEmbed = new MessageEmbed() + let successEmbed = new EmbedBuilder() .setTitle('Success') .setDescription(`Successfully gave <@${targetUserID}> ${item.name}`) .setColor('GREEN'); @@ -466,24 +451,24 @@ module.exports = { return interaction.send({ embeds: [successEmbed] }); } else if (args[0].name == 'clear') { - const prompt = new MessageEmbed() + const prompt = new EmbedBuilder() .setTitle(`Are you sure you want to clear your inventory?`) .setDescription('**Note:** This will not affect your wallet.') - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) - const opt = new MessageActionRow() + const opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`yes-${interaction.member.user.id}`) .setLabel("Yes") - .setStyle("DANGER"), - new MessageButton() + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() .setCustomId(`no-${interaction.member.user.id}`) .setLabel("No") - .setStyle("SUCCESS") + .setStyle(ButtonStyle.Success) ) - interaction.send({ embeds: [prompt], components: [opt], ephemeral: true }); + interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) }); client.on("interactionCreate", ButtonInteraction => { if(!ButtonInteraction.isButton()) return; @@ -491,7 +476,7 @@ module.exports = { if (!queryString.endsWith(ButtonInteraction.member.user.id)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } let action = '' @@ -501,17 +486,17 @@ module.exports = { client.dbo.collection("inventories").updateOne({"inventory.userID":inventory.userID},{$set:{[`inventory.guilds.${GuildDB.serverID}.items`]: [tempWallet]}},function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else if (queryString==`no-${interaction.member.user.id}`) action = 'kept'; - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setTitle(`Successfully ${action} your inventory.`) return ButtonInteraction.update({ embeds: [successEmbed], components: [] }); diff --git a/commands/me.js b/commands/me.js index d0eb366..efed3a5 100644 --- a/commands/me.js +++ b/commands/me.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); module.exports = { name: "me", @@ -9,16 +9,16 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [ + { + name: "action", + description: "Message to state your action", + value: "action", + type: 3, + required: true, + }, + ], SlashCommand: { - options: [ - { - name: "action", - description: "Message to state your action", - value: "action", - type: 3, - required: true, - }, - ], /** * * @param {require("../structures/QuarksBot")} client @@ -31,8 +31,8 @@ module.exports = { return interaction.send(`You are not allowed to use the bot in this channel.`); } - const actionEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor) + const actionEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle('Action Performed') .setDescription(`<@${interaction.member.user.id}> - *${args[0].value}*`) .setTimestamp() @@ -40,9 +40,9 @@ module.exports = { if (client.exists(GuildDB.actionChannel)) { const channel = interaction.guild.channels.cache.find(channel => channel.id === GuildDB.actionChannel); if (!channel) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nThe channel may have been deleted\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } diff --git a/commands/money.js b/commands/money.js index 4566784..d9527c3 100644 --- a/commands/money.js +++ b/commands/money.js @@ -1,4 +1,5 @@ -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); +const { Bank, addBank } = require('../structures/bank'); module.exports = { name: "money", @@ -9,53 +10,55 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: ["MANAGE_GUILD"], }, + options: [ + { + name: "add", + description: "Add money to user", + value: "add", + type: 1, + options: [ + { + name: "user", + description: "User to give money", + value: "user", + type: 6, + required: true, + }, + { + name: "amount", + description: "The amount to add to balance", + value: "amount", + type: 5, + min_value: 0.01, + required: true, + } + ], + }, + { + name: "remove", + description: "Remove money from user", + value: "remove", + type: 1, + options: [ + { + name: "user", + description: "User to remove money from", + value: "user", + type: 6, + required: true, + }, + { + name: "amount", + description: "The amount to add to balance", + value: "amount", + type: 5, + min_value: 0.01, + required: true, + } + ], + } + ], SlashCommand: { - options: [ - { - name: "add", - description: "Add money to user", - value: "add", - type: 1, - options: [ - { - name: "user", - description: "User to give money", - value: "user", - type: 6, - required: true, - }, - { - name: "amount", - description: "The amount to add to balance", - value: 1000.00, - type: 10, - required: true, - } - ], - }, - { - name: "remove", - description: "Remove money from user", - value: "remove", - type: 1, - options: [ - { - name: "user", - description: "User to remove money from", - value: "user", - type: 6, - required: true, - }, - { - name: "amount", - description: "The amount to add to balance", - value: 1000.00, - type: 10, - required: true, - } - ], - } - ], /** * * @param {require("../structures/QuarksBot")} client @@ -98,9 +101,9 @@ module.exports = { .catch(err => { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -112,9 +115,9 @@ module.exports = { const success = addBank(banking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance); if (!success) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -128,16 +131,16 @@ module.exports = { client.dbo.collection("banks").updateOne({"account.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - let successEmbed = new MessageEmbed() + let successEmbed = new EmbedBuilder() .setDescription(`Successfully added $${args[0].options[1].value.toFixed(2)} to <@${targetUserID}>'s balance`) .setColor('GREEN'); @@ -150,15 +153,15 @@ module.exports = { client.dbo.collection("banks").updateOne({"account.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - let successEmbed = new MessageEmbed() + let successEmbed = new EmbedBuilder() .setDescription(`Successfully removed $${args[0].options[1].value.toFixed(2)} from <@${targetUserID}>'s balance`) .setColor('GREEN'); diff --git a/commands/ping.js b/commands/ping.js index 99a510f..54b956f 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); module.exports = { name: "ping", @@ -9,8 +9,8 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [], SlashCommand: { - options: [], /** * * @param {require("../structures/QuarksBot")} client @@ -24,9 +24,9 @@ module.exports = { } const end = new Date().getTime(); - const pingEmbed = new MessageEmbed() + const pingEmbed = new EmbedBuilder() .setDescription(`šŸ“ **Pong!** Bot ping: ${end - start}ms`) - .setColor(client.config.EmbedColor); + .setColor(client.config.Colors.Default); return interaction.send({ embeds: [pingEmbed] }); }, diff --git a/commands/search.js b/commands/search.js index ca3a716..396cf29 100644 --- a/commands/search.js +++ b/commands/search.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); const { Inventory, addInventory } = require('../structures/inventory'); module.exports = { @@ -10,23 +10,23 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [ + { + name: "user", + description: "User to search", + value: "user", + type: 6, + required: true, + }, + { + name: "item-number", + description: "Item to view", + value: 1, + type: 4, + required: false, + }, + ], SlashCommand: { - options: [ - { - name: "user", - description: "User to search", - value: "user", - type: 6, - required: true, - }, - { - name: "item-number", - description: "Item to view", - value: 1, - type: 4, - required: false, - }, - ], /** * * @param {require("../structures/QuarksBot")} client @@ -69,27 +69,39 @@ module.exports = { .catch(err => { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else inventory = targetUserInventory.inventory; + if (!client.exists(inventory.guilds[GuildDB.serverID])) { + const success = addInventory(inventory.guilds, GuildDB.serverID, targetUserID, client); + if (!success) { + client.log(err); + const embed = new EmbedBuilder() + .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) + .setColor(client.config.Colors.Red) + + return interaction.send({ embeds: [embed] }); + } + } + // Display Inventory if (args[1]) { if (args[1].value < 0 || args[1].value > inventory.guilds[GuildDB.serverID].items.length) { - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setTitle("Please provide a valid item number") - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } let item = inventory.guilds[GuildDB.serverID].items[args[1].value-1]; - let itemEmbed = new MessageEmbed().setColor(client.config.EmbedColor); + let itemEmbed = new EmbedBuilder().setColor(client.config.Colors.Default); if (item.type == 'wallet') { // Display wallet @@ -117,11 +129,11 @@ module.exports = { itemEmbed.addFields({ name: item.name, value: item.description, inline: false }); } - return interaction.send({ embeds: [itemEmbed], ephemeral: true }); + return interaction.send({ embeds: [itemEmbed], flags: (1 << 6) }); } - let inventoryEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor) + let inventoryEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle(`${User.tag.split('#')[0]}'s Inventory`); let description = "```"; @@ -131,7 +143,7 @@ module.exports = { description += "```"; inventoryEmbed.setDescription(description); - return interaction.send({ embeds: [inventoryEmbed], ephemeral: true }); + return interaction.send({ embeds: [inventoryEmbed], flags: (1 << 6) }); }, }, } \ No newline at end of file diff --git a/commands/settings.js b/commands/settings.js index 4c62589..086607a 100644 --- a/commands/settings.js +++ b/commands/settings.js @@ -1,343 +1,344 @@ -const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js'); +const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); const bitfieldCalculator = require('discord-bitfield-calculator'); module.exports = { name: "settings", debug: false, description: "Configure your server settings", - usage: "[opt], ephemeral: true [action] [value]", + usage: "[opt], flags: (1 << 6) [action] [value]", permissions: { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: ["MANAGE_GUILD"], - }, - SlashCommand: { - options: [ - { - name: "allowed_channels", - description: "Set channels you're allowed to use the bot in", - value: "allowed_channels", - type: 2, - options: [ - { - name: "add", - description: "Add channel", - value: "add", - type: 1, - options: [{ - name: "channel", - description: "The channel to configure", - value: "channel", - type: 7, - required: true, - }] - }, - { - name: "remove", - description: "Remove channel", - value: "remove", - type: 1, - options: [{ - name: "channel", - description: "The channel to configure", - value: "channel", - type: 7, - required: true, - }] - }, - ] - }, - { - name: "action_channel", - description: "Set the channel to be used for /me commands", - value: "action_channel", - type: 2, - options: [ - { - name: "set", - description: "Set channel", - value: "set", - type: 1, - options: [{ - name: "channel", - description: "The channel to configure", - value: "channel", - type: 7, - required: true, - }] - }, - { - name: "remove", - description: "Remove channel", - value: "remove", - type: 1, - }, - ] - }, - { - name: "tweet_channel", - description: "Set the channel to be used for /tweet commands", - value: "tweet_channel", - type: 2, - options: [ - { - name: "set", - description: "Set channel", - value: "set", - type: 1, - options: [{ - name: "channel", - description: "The channel to configure", - value: "channel", - type: 7, - required: true, - }] - }, - { - name: "remove", - description: "Remove channel", - value: "remove", - type: 1, - }, - ] - }, - { - name: "adverts_channel", - description: "Set the channel for users to send commercial adverts", - value: "adverts_channel", - type: 2, - options: [ - { - name: "set", - description: "Set channel", - value: "set", - type: 1, - options: [{ - name: "channel", - description: "The channel to configure", - value: "channel", - type: 7, - required: true, - }] - }, - { - name: "remove", - description: "Remove channel", - value: "remove", - type: 1, - }, - ] - }, - { - name: "dispatcher_channel", - description: "Set the channel for dispatchers to recieve notifications.", - value: "adverts_channel", - type: 2, - options: [ - { - name: "set", - description: "Set channel", - value: "set", - type: 1, - options: [{ - name: "channel", - description: "The channel to configure", - value: "channel", - type: 7, - required: true - }] - }, - { - name: "remove", - description: "Remove channel", - value: "remove", - type: 1, - }, - ] - }, - { - name: "starting_balance", - description: "Set the starting balance", - value: "starting_balance", - type: 1, - options: [{ - name: "amount", - description: "The amount to set the starting balance", - value: 1000.00, - type: 10, - required: true, - }] - }, - { - name: "income_role", - description: "Add/update a role to earn income on /work command", - value: "set_income_role", - type: 2, - options: [ - { - name: "set", - description: "Set role", - value: "set", - type: 1, - options: [ - { - name: "role", - description: "Role to set", - value: "role", - type: 8, - required: true, - }, - { - name: "amount", - description: "The amount to earn in 1 day of work", - value: 120.00, - type: 10, - required: false, - } - ] - }, - { - name: "remove", - description: "Remove role", - value: "remove", - type: 1, - options: [{ + }, + options: [ + { + name: "allowed_channels", + description: "Set channels you're allowed to use the bot in", + value: "allowed_channels", + type: 2, + options: [ + { + name: "add", + description: "Add channel", + value: "add", + type: 1, + options: [{ + name: "channel", + description: "The channel to configure", + value: "channel", + type: 7, + required: true, + }] + }, + { + name: "remove", + description: "Remove channel", + value: "remove", + type: 1, + options: [{ + name: "channel", + description: "The channel to configure", + value: "channel", + type: 7, + required: true, + }] + }, + ] + }, + { + name: "action_channel", + description: "Set the channel to be used for /me commands", + value: "action_channel", + type: 2, + options: [ + { + name: "set", + description: "Set channel", + value: "set", + type: 1, + options: [{ + name: "channel", + description: "The channel to configure", + value: "channel", + type: 7, + required: true, + }] + }, + { + name: "remove", + description: "Remove channel", + value: "remove", + type: 1, + }, + ] + }, + { + name: "tweet_channel", + description: "Set the channel to be used for /tweet commands", + value: "tweet_channel", + type: 2, + options: [ + { + name: "set", + description: "Set channel", + value: "set", + type: 1, + options: [{ + name: "channel", + description: "The channel to configure", + value: "channel", + type: 7, + required: true, + }] + }, + { + name: "remove", + description: "Remove channel", + value: "remove", + type: 1, + }, + ] + }, + { + name: "adverts_channel", + description: "Set the channel for users to send commercial adverts", + value: "adverts_channel", + type: 2, + options: [ + { + name: "set", + description: "Set channel", + value: "set", + type: 1, + options: [{ + name: "channel", + description: "The channel to configure", + value: "channel", + type: 7, + required: true, + }] + }, + { + name: "remove", + description: "Remove channel", + value: "remove", + type: 1, + }, + ] + }, + { + name: "dispatcher_channel", + description: "Set the channel for dispatchers to recieve notifications.", + value: "adverts_channel", + type: 2, + options: [ + { + name: "set", + description: "Set channel", + value: "set", + type: 1, + options: [{ + name: "channel", + description: "The channel to configure", + value: "channel", + type: 7, + }] + }, + { + name: "remove", + description: "Remove channel", + value: "remove", + type: 1, + }, + ] + }, + { + name: "starting_balance", + description: "Set the starting balance", + value: "starting_balance", + type: 1, + options: [{ + name: "amount", + description: "The amount to set the starting balance", + value: "amount", + type: 5, + min_value: 0.01, + required: true, + }] + }, + { + name: "income_role", + description: "Add/update a role to earn income on /work command", + value: "set_income_role", + type: 2, + options: [ + { + name: "set", + description: "Set role", + value: "set", + type: 1, + options: [ + { name: "role", - description: "Role to remove", + description: "Role to set", value: "role", type: 8, required: true, - }] - }, - ], - }, - { - name: "bot_admin_role", - description: "Set/remove bot admin role", - value: "bot_admin_role", - type: 2, - options: [ - { - name: "set", - description: "Set role", + }, + { + name: "amount", + description: "The amount to earn in 1 day of work", + value: 120.00, + type: 5, + min_value: 0.01, + required: false, + } + ] + }, + { + name: "remove", + description: "Remove role", + value: "remove", + type: 1, + options: [{ + name: "role", + description: "Role to remove", value: "role", type: 8, - options: [{ - name: "role", - description: "Role to set", - value: "role", - type: 8, - required: true, - }] - }, - { - name: "remove", - description: "Remove role", - value: "remove", - type: 1, - }, - ] - }, - { - name: "commercial_role", - description: "Set/remove commercial role", - value: "commercial_role", - type: 2, - options: [ - { - name: "set", - description: "Set role", - value: "set", - type: 1, - options: [{ - name: "role", - description: "Role to set", - value: "role", - type: 8, - required: true, - }] - }, - { - name: "remove", - description: "Remove role", - value: "remove", - type: 1, - }, - ] - }, - { - name: "officer_role", - description: "Set/remove officer role", - value: "officer_role", - type: 2, - options: [ - { - name: "set", - description: "Set role", - value: "set", - type: 1, - options: [{ - name: "role", - description: "Role to set", - value: "role", - type: 8, - required: true, - }] - }, - { - name: "remove", - description: "Remove role", - value: "remove", - type: 1, - }, - ] - }, - { - name: "dispatcher_role", - description: "Set/remove dispatcher role", - value: "officer_role", - type: 2, - options: [ - { - name: "set", - description: "Set role", - value: "set", - type: 1, - options: [{ - name: "role", - description: "Role to set", - value: "role", - type: 8, - required: true, - }], - }, - { - name: "remove", - description: "Remove role", - value: "remove", - type: 1, - }, - ] - }, - { - name: "only_officers_search", - description: "Determine if only officers can use /search", - value: "only_officers_search", - type: 1, - options: [{ - name: "true_or_false", - description: "Enable or Disable setting", - value: false, - type: 5, - required: true, - }] - }, - { - name: "view", - description: "View current settings configuration", - value: "view", - type: 1, - } - ], + required: true, + }] + }, + ], + }, + { + name: "bot_admin_role", + description: "Set/remove bot admin role", + value: "bot_admin_role", + type: 2, + options: [ + { + name: "set", + description: "Set role", + value: "role", + type: 1, + options: [{ + name: "role", + description: "Role to set", + value: "role", + type: 8, + required: true, + }] + }, + { + name: "remove", + description: "Remove role", + value: "remove", + type: 1, + }, + ] + }, + { + name: "commercial_role", + description: "Set/remove commercial role", + value: "commercial_role", + type: 2, + options: [ + { + name: "set", + description: "Set role", + value: "set", + type: 1, + options: [{ + name: "role", + description: "Role to set", + value: "role", + type: 8, + required: true, + }] + }, + { + name: "remove", + description: "Remove role", + value: "remove", + type: 1, + }, + ] + }, + { + name: "officer_role", + description: "Set/remove officer role", + value: "officer_role", + type: 2, + options: [ + { + name: "set", + description: "Set role", + value: "set", + type: 1, + options: [{ + name: "role", + description: "Role to set", + value: "role", + type: 8, + required: true, + }] + }, + { + name: "remove", + description: "Remove role", + value: "remove", + type: 1, + }, + ] + }, + { + name: "dispatcher_role", + description: "Set/remove dispatcher role", + value: "officer_role", + type: 2, + options: [ + { + name: "set", + description: "Set role", + value: "set", + type: 1, + options: [{ + name: "role", + description: "Role to set", + value: "role", + type: 8, + required: true, + }], + }, + { + name: "remove", + description: "Remove role", + value: "remove", + type: 1, + }, + ] + }, + { + name: "only_officers_search", + description: "Determine if only officers can use /search", + value: "only_officers_search", + type: 1, + options: [{ + name: "true_or_false", + description: "Enable or Disable setting", + value: false, + type: 5, + required: true, + }] + }, + { + name: "view", + description: "View current settings configuration", + value: "view", + type: 1, + } + ], + SlashCommand: { /** * * @param {require("../structures/QuarksBot")} client @@ -363,7 +364,7 @@ module.exports = { if (args[0].options[0].name == 'add') { const channel = client.channels.cache.get(channelid); - const errorEmbed = new MessageEmbed().setColor("RED") + const errorEmbed = new EmbedBuilder().setColor(client.config.Colors.Red) let error = false; if (!channel) {error=true;errorEmbed.setDescription(`**Error Notice:** Cannot find that channel.`);} @@ -373,44 +374,44 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$push:{"server.allowedChannels": channelid}}, function (err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setDescription(`**Success:** Set <#${channelid}> as an allowed channel.`); return interaction.send({ embeds: [successEmbed] }); } else if (args[0].options[0].name=='remove') { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescription(`**Error Notice:** <#${channelid}> is not in allowed channels.`) - .setColor("RED") + .setColor(client.config.Colors.Red) if (!GuildDB.allowedChannels.includes(channelid)) return interaction.send({ embeds: [embed] }); - const prompt = new MessageEmbed() + const prompt = new EmbedBuilder() .setTitle(`Are you sure you want to remove this channel from allowed channels?`) - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) - const opt = new MessageActionRow() + const opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`yes-${interaction.member.user.id}`) .setLabel("Yes") - .setStyle("DANGER"), - new MessageButton() + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() .setCustomId(`no-${interaction.member.user.id}`) .setLabel("No") - .setStyle("SUCCESS") + .setStyle(ButtonStyle.Success) ) - interaction.send({ embeds: [prompt], components: [opt], ephemeral: true }); + interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) }); client.on("interactionCreate", ButtonInteraction => { if(!ButtonInteraction.isButton()) return; @@ -418,7 +419,7 @@ module.exports = { if (!queryString.endsWith(ButtonInteraction.member.user.id)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } let action = '' @@ -427,17 +428,17 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull:{"server.allowedChannels": channelid}}, function (err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else if (queryString==`no-${interaction.member.user.id}`) action = 'kept'; - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setTitle(`Success: You ${action} the channel.`) return ButtonInteraction.update({ content: '', embeds: [successEmbed], components: [] }); @@ -450,45 +451,45 @@ module.exports = { const channelid = args[0].options[0].options[0].value; const channelSetting = GuildDB.actionChannel; - const presetEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor) + const presetEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setDescription(`The channel <#${channelid}> has already been set for actions.`) if (channelSetting == channelid) return interaction.send({ embeds: [presetEmbed] }); client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.actionChannel":channelid}},function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setDescription(`**Success:** Set <#${channelid}> as the action channel.`); return interaction.send({ embeds: [successEmbed] }); } else if (args[0].options[0].name== 'remove') { - const prompt = new MessageEmbed() + const prompt = new EmbedBuilder() .setTitle(`Are you sure you want to stop using this channel for actions?`) - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) - const opt = new MessageActionRow() + const opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`yes-${interaction.member.user.id}`) .setLabel("Yes") - .setStyle("DANGER"), - new MessageButton() + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() .setCustomId(`no-${interaction.member.user.id}`) .setLabel("No") - .setStyle("SUCCESS") + .setStyle(ButtonStyle.Success) ) - interaction.send({ embeds: [prompt], components: [opt], ephemeral: true }); + interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) }); client.on("interactionCreate", ButtonInteraction => { if(!ButtonInteraction.isButton()) return; @@ -496,7 +497,7 @@ module.exports = { if (!queryString.endsWith(ButtonInteraction.member.user.id)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } let action = '' @@ -505,17 +506,17 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":ButtonInteraction.guild.id},{$set:{"server.actionChannel": null}},function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else if (queryString==`no-${interaction.member.user.id}`) action = 'kept'; - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setTitle(`Success: You ${action} the channel.`) return ButtonInteraction.update({ content: '', embeds: [successEmbed], components: [] }); @@ -528,45 +529,45 @@ module.exports = { const channelid = args[0].options[0].options[0].value; const channelSetting = GuildDB.tweetChannel; - const presetEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor) + const presetEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setDescription(`The channel <#${channelid}> has already been set for tweets.`) if (channelSetting == channelid) return interaction.send({ embeds: [presetEmbed] }); client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.tweetChannel":channelid}},function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setDescription(`**Success:** Set <#${channelid}> as the tweet channel.`); return interaction.send({ embeds: [successEmbed] }); } else if (args[0].options[0].name== 'remove') { - const prompt = new MessageEmbed() + const prompt = new EmbedBuilder() .setTitle(`Are you sure you want to stop using this channel for tweets?`) - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) - const opt = new MessageActionRow() + const opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`yes-${interaction.member.user.id}`) .setLabel("Yes") - .setStyle("DANGER"), - new MessageButton() + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() .setCustomId(`no-${interaction.member.user.id}`) .setLabel("No") - .setStyle("SUCCESS") + .setStyle(ButtonStyle.Success) ) - interaction.send({ embeds: [prompt], components: [opt], ephemeral: true }); + interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) }); client.on("interactionCreate", ButtonInteraction => { if(!ButtonInteraction.isButton()) return; @@ -574,7 +575,7 @@ module.exports = { if (!queryString.endsWith(ButtonInteraction.member.user.id)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } let action = '' @@ -583,17 +584,17 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":ButtonInteraction.guild.id},{$set:{"server.tweetChannel": null}},function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else if (queryString==`no-${interaction.member.user.id}`) action = 'kept'; - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setTitle(`Success: You ${action} the channel.`) return ButtonInteraction.update({ content: '', embeds: [successEmbed], components: [] }); @@ -606,45 +607,45 @@ module.exports = { const channelid = args[0].options[0].options[0].value; const channelSetting = GuildDB.advertsChannel; - const presetEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor) + const presetEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setDescription(`The channel <#${channelid}> has already been set for advertisements.`) if (channelSetting == channelid) return interaction.send({ embeds: [presetEmbed] }); client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.advertsChannel":channelid}},function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setDescription(`**Success:** Set <#${channelid}> for advertisements.`) return interaction.send({ embeds: [successEmbed] }); } else if (args[0].options[0].name== 'remove') { - const prompt = new MessageEmbed() + const prompt = new EmbedBuilder() .setTitle(`Are you sure you want to stop using this channel for advertisements?`) - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) - const opt = new MessageActionRow() + const opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`yes-${interaction.member.user.id}`) .setLabel("Yes") - .setStyle("DANGER"), - new MessageButton() + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() .setCustomId(`no-${interaction.member.user.id}`) .setLabel("No") - .setStyle("SUCCESS") + .setStyle(ButtonStyle.Success) ) - interaction.send({ embeds: [prompt], components: [opt], ephemeral: true }); + interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) }); client.on("interactionCreate", ButtonInteraction => { if(!ButtonInteraction.isButton()) return; @@ -652,7 +653,7 @@ module.exports = { if (!queryString.endsWith(ButtonInteraction.member.user.id)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } let action = ''; @@ -661,17 +662,17 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":ButtonInteraction.guild.id},{$set:{"server.advertsChannel": null}},function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else if (queryString==`no-${interaction.member.user.id}`) action = 'kept'; - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setTitle(`Success: You ${action} the channel.`) return ButtonInteraction.update({ content: '', embeds: [successEmbed], components: [] }); @@ -685,45 +686,45 @@ module.exports = { const channelid = args[0].options[0].options[0].value; const channelSetting = GuildDB.advertsChannel; - const presetEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor) + const presetEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setDescription(`The channel <#${channelid}> has already been set for dispatchers.`) if (channelSetting == channelid) return interaction.send({ embeds: [presetEmbed] }); client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.dispatchChannel":channelid}},function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setDescription(`**Success:** Set <#${channelid}> for dispatchers.`) return interaction.send({ embeds: [successEmbed] }); } else if (args[0].options[0].name== 'remove') { - const prompt = new MessageEmbed() + const prompt = new EmbedBuilder() .setTitle(`Are you sure you want to stop using this channel for advertisements?`) - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) - const opt = new MessageActionRow() + const opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`yes-${interaction.member.user.id}`) .setLabel("Yes") - .setStyle("DANGER"), - new MessageButton() + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() .setCustomId(`no-${interaction.member.user.id}`) .setLabel("No") - .setStyle("SUCCESS") + .setStyle(ButtonStyle.Success) ) - interaction.send({ embeds: [prompt], components: [opt], ephemeral: true }); + interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) }); client.on("interactionCreate", ButtonInteraction => { if(!ButtonInteraction.isButton()) return; @@ -731,7 +732,7 @@ module.exports = { if (!queryString.endsWith(ButtonInteraction.member.user.id)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } let action = ''; @@ -740,17 +741,17 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":ButtonInteraction.guild.id},{$set:{"server.dispatchChannel": null}},function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else if (queryString==`no-${interaction.member.user.id}`) action = 'kept'; - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setTitle(`Success: You ${action} the channel.`) return ButtonInteraction.update({ content: '', embeds: [successEmbed], components: [] }); @@ -762,15 +763,15 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {"server.startingBalance":args[0].options[0].value}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - let successEmbed = new MessageEmbed() + let successEmbed = new EmbedBuilder() .setColor('GREEN') .setDescription(`Successfully set $${args[0].options[0].value.toFixed(2)} as starting balance`); @@ -781,9 +782,9 @@ module.exports = { const roleId = args[0].options[0].options[0].value if (args[0].options[0].options[1].value <= 0) { - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setDescriptions('**Error Notice:** Amount cannot be $0 or less than $0.') - .setColor("RED"); + .setColor(client.config.Colors.Red); return interaction.send({ embeds: [embed] }); } @@ -798,9 +799,9 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$push: {"server.incomeRoles":newIncome}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -810,9 +811,9 @@ module.exports = { {$set: {"server.incomeRoles.$.income": args[0].options[0].options[1].value}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -820,7 +821,7 @@ module.exports = { } const perform = searchIndex = -1 ? 'set' : 'updated'; - const successEmbed = new MessageEmbed() + const successEmbed = new EmbedBuilder() .setDescription(`Successfully ${perform} <@&${roleId}>'s income to $${args[0].options[0].options[1].value}`) .setColor('GREEN'); @@ -829,29 +830,29 @@ module.exports = { } else if (args[0].options[0].name== 'remove') { const searchIndex = GuildDB.incomeRoles.findIndex((role) => role.role==roleId); if (searchIndex == -1) { - const errorEmbed = new MessageEmbed() + const errorEmbed = new EmbedBuilder() .setDescription('**Error Notice:** Role not found') - .setColor("RED"); + .setColor(client.config.Colors.Red); return interaction.send({ embeds: [errorEmbed] }); } else { - const prompt = new MessageEmbed() + const prompt = new EmbedBuilder() .setTitle(`Are you sure you want to remove this role as an income?`) - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) - const opt = new MessageActionRow() + const opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`yes-${interaction.member.user.id}`) .setLabel("Yes") - .setStyle("DANGER"), - new MessageButton() + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() .setCustomId(`no-${interaction.member.user.id}`) .setLabel("No") - .setStyle("SUCCESS") + .setStyle(ButtonStyle.Success) ) - interaction.send({ embeds: [prompt], components: [opt], ephemeral: true }); + interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) }); client.on("interactionCreate", ButtonInteraction => { if(!ButtonInteraction.isButton()) return; @@ -859,7 +860,7 @@ module.exports = { if (!queryString.endsWith(ButtonInteraction.member.user.id)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } let action = ''; @@ -868,17 +869,17 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull: {"server.incomeRoles": roleId}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else if (queryString==`no-${interaction.member.user.id}`) action = 'kept'; - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setTitle(`Successfully ${action} <@&${roleId}> from income roles.`) return ButtonInteraction.update({ content: '', embeds: [successEmbed], components: [] }); @@ -894,38 +895,38 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.commercialRole": roleId}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const successEmbed = new MessageEmbed() + const successEmbed = new EmbedBuilder() .setDescription(`Successfully set <@&${roleId}> as commercial role.\nUsers with this role can now use business commands.`) .setColor('GREEN'); return interaction.send({ embeds: [successEmbed] }); } else if (args[0].options[0].name== 'remove') { - const prompt = new MessageEmbed() + const prompt = new EmbedBuilder() .setTitle(`Are you sure you want to remove this role as commercial role?`) - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) - const opt = new MessageActionRow() + const opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`yes-${interaction.member.user.id}`) .setLabel("Yes") - .setStyle("DANGER"), - new MessageButton() + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() .setCustomId(`no-${interaction.member.user.id}`) .setLabel("No") - .setStyle("SUCCESS") + .setStyle(ButtonStyle.Success) ) - interaction.send({ embeds: [prompt], components: [opt], ephemeral: true }); + interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) }); client.on("interactionCreate", ButtonInteraction => { if(!ButtonInteraction.isButton()) return; @@ -933,7 +934,7 @@ module.exports = { if (!queryString.endsWith(ButtonInteraction.member.user.id)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } let action = ''; @@ -942,17 +943,17 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.commercialRole": null}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else if (queryString==`no-${interaction.member.user.id}`) action = 'kept'; - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setTitle(`Successfully ${action} <@&${roleId}> as commercial role.`) return ButtonInteraction.update({ content: '', embeds: [successEmbed], components: [] }); @@ -968,38 +969,38 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.officerRole": roleId}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const successEmbed = new MessageEmbed() + const successEmbed = new EmbedBuilder() .setDescription(`Successfully set <@&${roleId}> as officer role.\nUsers with this role can now fine other users.`) .setColor('GREEN'); return interaction.send({ embeds: [successEmbed] }); } else if (args[0].options[0].name== 'remove') { - const prompt = new MessageEmbed() + const prompt = new EmbedBuilder() .setTitle(`Are you sure you want to remove this role as officer role?`) - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) - const opt = new MessageActionRow() + const opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`yes-${interaction.member.user.id}`) .setLabel("Yes") - .setStyle("DANGER"), - new MessageButton() + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() .setCustomId(`no-${interaction.member.user.id}`) .setLabel("No") - .setStyle("SUCCESS") + .setStyle(ButtonStyle.Success) ) - interaction.send({ embeds: [prompt], components: [opt], ephemeral: true }); + interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) }); client.on("interactionCreate", ButtonInteraction => { if(!ButtonInteraction.isButton()) return; @@ -1007,7 +1008,7 @@ module.exports = { if (!queryString.endsWith(ButtonInteraction.member.user.id)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } let action = ''; @@ -1016,17 +1017,17 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.officerRole": null}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else if (queryString==`no-${interaction.member.user.id}`) action = 'kept'; - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setTitle(`Successfully ${action} <@&${roleId}> as officer role.`) return ButtonInteraction.update({ content: '', embeds: [successEmbed], components: [] }); @@ -1042,38 +1043,38 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.dispatcherRole": roleId}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const successEmbed = new MessageEmbed() + const successEmbed = new EmbedBuilder() .setDescription(`Successfully set <@&${roleId}> as dispatcher role.\nUsers with this role can now receive 911/311 notifications.`) .setColor('GREEN'); return interaction.send({ embeds: [successEmbed] }); } else if (args[0].options[0].name== 'remove') { - const prompt = new MessageEmbed() + const prompt = new EmbedBuilder() .setTitle(`Are you sure you want to remove this role as dispatcher role?`) - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) - const opt = new MessageActionRow() + const opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`yes-${interaction.member.user.id}`) .setLabel("Yes") - .setStyle("DANGER"), - new MessageButton() + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() .setCustomId(`no-${interaction.member.user.id}`) .setLabel("No") - .setStyle("SUCCESS") + .setStyle(ButtonStyle.Success) ) - interaction.send({ embeds: [prompt], components: [opt], ephemeral: true }); + interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) }); client.on("interactionCreate", ButtonInteraction => { if(!ButtonInteraction.isButton()) return; @@ -1081,7 +1082,7 @@ module.exports = { if (!queryString.endsWith(ButtonInteraction.member.user.id)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } let action = ''; @@ -1090,17 +1091,17 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.dispatcherRole": null}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else if (queryString==`no-${interaction.member.user.id}`) action = 'kept'; - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setTitle(`Successfully ${action} <@&${roleId}> as dispatcher role.`) return ButtonInteraction.update({ content: '', embeds: [successEmbed], components: [] }); @@ -1116,38 +1117,38 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.botAdmin": roleId}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const successEmbed = new MessageEmbed() + const successEmbed = new EmbedBuilder() .setDescription(`Successfully set <@&${roleId}> as a bot admin role.\nUsers with this role can use restricted commands.`) .setColor('GREEN'); return interaction.send({ embeds: [successEmbed] }); } else if (args[0].options[0].name== 'remove') { - const prompt = new MessageEmbed() + const prompt = new EmbedBuilder() .setTitle(`Are you sure you want to remove this role as a bot admin?`) - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) - const opt = new MessageActionRow() + const opt = new ActionRowBuilder() .addComponents( - new MessageButton() + new ButtonBuilder() .setCustomId(`yes-${interaction.member.user.id}`) .setLabel("Yes") - .setStyle("DANGER"), - new MessageButton() + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() .setCustomId(`no-${interaction.member.user.id}`) .setLabel("No") - .setStyle("SUCCESS") + .setStyle(ButtonStyle.Success) ) - interaction.send({ embeds: [prompt], components: [opt], ephemeral: true }); + interaction.send({ embeds: [prompt], components: [opt], flags: (1 << 6) }); client.on("interactionCreate", ButtonInteraction => { if(!ButtonInteraction.isButton()) return; @@ -1155,7 +1156,7 @@ module.exports = { if (!queryString.endsWith(ButtonInteraction.member.user.id)) { return ButtonInteraction.reply({ content: "This button is not for you", - ephemeral: true + flags: (1 << 6) }) } let action = ''; @@ -1164,17 +1165,17 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.botAdmin": null}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else if (queryString==`no-${interaction.member.user.id}`) action = 'kept'; - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setTitle(`Successfully ${action} <@&${roleId}> as dispatcher role.`) return ButtonInteraction.update({ content: '', embeds: [successEmbed], components: [] }); @@ -1186,9 +1187,9 @@ module.exports = { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.onlyOfficersSearch": setting}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -1196,8 +1197,8 @@ module.exports = { const title = setting ? 'Only officers can use /search' : 'Any user can use /search'; - const successEmbed = new MessageEmbed() - .setColor("GREEN") + const successEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Green) .setTitle(title) return interaction.send({ embeds: [successEmbed] }); @@ -1226,8 +1227,8 @@ module.exports = { const botAdminRole = GuildDB.botAdmin ? `\nā•šāž¤ <#${GuildDB.botAdmin}>` : ''; const botAdminRoleColor = GuildDB.botAdmin ? `+ ` : '- '; - const settingsEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor) + const settingsEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle('Current Guild Configurations') .addFields( { name: 'Guild ID', value: `\`\`\`arm\n${GuildDB.serverID}\`\`\``, inline: true }, diff --git a/commands/stats.js b/commands/stats.js index 85fb882..e150322 100644 --- a/commands/stats.js +++ b/commands/stats.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); module.exports = { name: "stats", @@ -9,8 +9,8 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [], SlashCommand: { - options: [], /** * * @param {require("../structures/QuarksBot")} client @@ -24,8 +24,8 @@ module.exports = { } const end = new Date().getTime(); - const stats = new MessageEmbed() - .setColor(client.config.EmbedColor) + const stats = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle('QuarksBot Statistics') .addFields( { name: 'Guilds', value: `${client.guilds.cache.size}`, inline: true }, diff --git a/commands/tweet.js b/commands/tweet.js index 2cde3ea..956ad44 100644 --- a/commands/tweet.js +++ b/commands/tweet.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); module.exports = { name: "tweet", @@ -9,16 +9,16 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [ + { + name: "message", + description: "Your message to tweet", + value: "message", + type: 3, + required: true, + }, + ], SlashCommand: { - options: [ - { - name: "message", - description: "Your message to tweet", - value: "message", - type: 3, - required: true, - }, - ], /** * * @param {require("../structures/QuarksBot")} client @@ -34,7 +34,7 @@ module.exports = { let userID = interaction.member.user.id; let avatar = interaction.member.user.avatar; - const tweetEmbed = new MessageEmbed() + const tweetEmbed = new EmbedBuilder() .setColor('#0099ff') .setTitle('New Twitter Notifciation') .setThumbnail('https://static.vecteezy.com/system/resources/previews/002/534/045/original/social-media-twitter-logo-blue-isolated-free-vector.jpg') @@ -45,9 +45,9 @@ module.exports = { if (client.exists(GuildDB.tweetChannel)) { const channel = interaction.guild.channels.cache.find(channel => channel.id === GuildDB.tweetChannel); if (!channel) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nThe channel may have been deleted\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } diff --git a/commands/wallet.js b/commands/wallet.js index e4c9351..62fc406 100644 --- a/commands/wallet.js +++ b/commands/wallet.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); module.exports = { name: "wallet", @@ -9,40 +9,41 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [ + { + name: "view", + description: "view your wallet", + value: "view", + type: 1, + }, + { + name: "id-set", + description: "set values on your id", + value: "id-set", + type: 1, + options: [ + { + name: "alter", + description: "value to alter", + value: "alter", + type: 3, + required: true, + choices: [ + { name: "firstname", value: "firstname" }, { name: "lastname", value: "lastname" }, + { name: "dob", value: "dob" }, { name: "address", value: "address" }, + ] + }, + { + name: "value", + description: "New value of what you'd like to change", + value: "value", + type: 3, + required: true, + }, + ] + } + ], SlashCommand: { - options: [ - { - name: "view", - description: "view your wallet", - value: "view", - type: 1, - }, - { - name: "id-set", - description: "set values on your id", - value: "id-set", - type: 1, - options: [ - { - name: "value", - description: "value to set on id", - value: "value", - type: 3, - choices: [ - { name: "firstname", value: "firstname" }, { name: "lastname", value: "lastname" }, - { name: "dob", value: "dob" }, { name: "address", value: "address" }, - ] - }, - { - name: "value", - description: "New value of what you'd like to change", - value: "value", - type: 3, - required: true, - }, - ] - } - ], /** * * @param {require("../structures/QuarksBot")} client @@ -84,9 +85,9 @@ module.exports = { .catch(err => { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -97,9 +98,9 @@ module.exports = { const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client); if (!success) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -111,9 +112,9 @@ module.exports = { let item = inventory.guilds[GuildDB.serverID].items[0]; let ID = `${client.exists(item.ID.firstname) ? item.ID.firstname : '...'} ${client.exists(item.ID.lastname) ? item.ID.lastname : '...'} | ${client.exists(item.ID.dob) ? item.ID.dob : 'N/A'} | ${client.exists(item.ID.addr) ? item.ID.addr : 'N/A'}` - let walletEmbed = new MessageEmbed() + let walletEmbed = new EmbedBuilder() .setTitle(`Your Wallet`) - .setColor(client.config.EmbedColor) + .setColor(client.config.Colors.Default) .addFields( { name: '**Cash**', value: `$${item.cash.toFixed(2)}`, inline: true }, { name: '**ID**', value: ID, inline: true }); @@ -138,9 +139,9 @@ module.exports = { } if (!isDate(args[0].options[1].value)) { - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setTitle("Invalid Date of Birth") - .setColor("RED"); + .setColor(client.config.Colors.Red); return interaction.send({ embeds: [embed] }); } @@ -155,15 +156,15 @@ module.exports = { client.dbo.collection("inventories").updateOne(query, update, function (err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - let successEmbed = new MessageEmbed() + let successEmbed = new EmbedBuilder() .setTitle('Success') .setDescription(`Successfully set ${updateAction}\nUse \`/inventory wallet\` to view your updated ID`) .setColor('GREEN'); diff --git a/commands/work-roles.js b/commands/work-roles.js index 12d606c..b770d57 100644 --- a/commands/work-roles.js +++ b/commands/work-roles.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require('discord.js'); +const { EmbedBuilder } = require('discord.js'); module.exports = { name: "work-roles", @@ -9,8 +9,8 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [], SlashCommand: { - options: [], /** * * @param {require("../structures/QuarksBot")} client @@ -24,8 +24,8 @@ module.exports = { } if (GuildDB.incomeRoleStatus) { - let listEmbed = new MessageEmbed() - .setColor(client.config.EmbedColor) + let listEmbed = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle('List of Work Roles') let data = `` @@ -38,8 +38,8 @@ module.exports = { return interaction.send({ embeds: [listEmbed] }) } else { - let noRoles = new MessageEmbed() - .setColor(client.config.EmbedColor) + let noRoles = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setDescription('**QuarksBot Notice:** There are no income roles') return interaction.send({ embeds: [noRoles] }); diff --git a/commands/work.js b/commands/work.js index 7ef9122..f608232 100644 --- a/commands/work.js +++ b/commands/work.js @@ -1,5 +1,6 @@ -const { MessageEmbed, } = require('discord.js'); +const { EmbedBuilder, } = require('discord.js'); const { Inventory, addInventory } = require('../structures/inventory'); +const { Bank, addBank } = require('../structures/bank'); module.exports = { name: "work", @@ -10,8 +11,8 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, + options: [], SlashCommand: { - options: [], /** * * @param {require("../structures/QuarksBot")} client @@ -30,7 +31,7 @@ module.exports = { }); if (!hasWorkRole) { - const error = new MessageEmbed() + const error = new EmbedBuilder() .setColor('RED') .setTitle('Missing Work!') .setDescription(`It appears you don't have any work, apply for some jobs to earn your income.`) @@ -51,14 +52,26 @@ module.exports = { .catch(err => { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); } else inventory = inventory.inventory + + if (!client.exists(inventory.guilds[GuildDB.serverID])) { + const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client); + if (!success) { + client.log(err); + const embed = new EmbedBuilder() + .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) + .setColor(client.config.Colors.Red) + + return interaction.send({ embeds: [embed] }); + } + } const now = new Date(); const msBetweenDates = Math.abs(inventory.lastWork - now) @@ -96,9 +109,9 @@ module.exports = { .catch(err => { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -110,9 +123,9 @@ module.exports = { const success = addBank(banking.guilds, GuildDB.serverID, interaction.member.user.id, client, GuildDB.startingBalance); if (!success) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -130,9 +143,9 @@ module.exports = { client.dbo.collection("banks").updateOne({"account.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } @@ -141,23 +154,23 @@ module.exports = { client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id}, {$set: {[`inventory.guilds.${GuildDB.serverID}.lastWork`]: now}}, function(err, res) { if (err) { client.log(err); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) - .setColor("RED") + .setColor(client.config.Colors.Red) return interaction.send({ embeds: [embed] }); } }); - const success = new MessageEmbed() + const success = new EmbedBuilder() .setColor('GREEN') .setDescription(`You worked your job <@&${job}> and earned $${earned}.`) return interaction.send({ embeds: [success] }) } else { - const error = new MessageEmbed() - .setColor(client.config.EmbedColor) + const error = new EmbedBuilder() + .setColor(client.config.Colors.Default) .setTitle('Take a rest...') .setDescription(`You've already worked a full day today. Take a rest and work tomorrow.`) diff --git a/config/config.js b/config/config.js index aac08c3..7da8c91 100644 --- a/config/config.js +++ b/config/config.js @@ -8,11 +8,14 @@ module.exports = { Token: process.env.token || "", //Discord Bot Token Scopes: ["identify", "guilds", "applications.commands"], //Discord OAuth2 Scopes IconURL: "", - EmbedColor: "#6e5145", + Colors: { + Default: "#6e5145", + Red: "#ba0f0f", + Green: "#32a852", + }, Permissions: 2205281600, mongoURI: process.env.mongoURI || "mongodb://localhost:27017", dbo: process.env.dbo || "knoldus", - Presence: { status: "online", // You can show online, idle, and dnd name: "Grand Theft Auto V", // The message shown diff --git a/index.js b/index.js index 855624d..93e14ab 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ const QuarksBot = require('./structures/QuarksBot'); const config = require('./config/config'); -const { Intents } = require('discord.js'); +const { GatewayIntentBits } = require('discord.js'); -let client = new QuarksBot({ intents:[Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]}, config); +let client = new QuarksBot({ intents:[GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages]}, config); client.build() diff --git a/package-lock.json b/package-lock.json index 892b5ad..92f41e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,10 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@discordjs/rest": "^1.1.0", "colors": "^1.4.0", "discord-bitfield-calculator": "^1.0.0", - "discord.js": "^13.8.1", + "discord.js": "^14.3.0", "mongodb": "^4.7.0", "mongoose": "^6.4.2", "winston": "^3.8.1" @@ -36,13 +37,12 @@ } }, "node_modules/@discordjs/builders": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.14.0.tgz", - "integrity": "sha512-+fqLIqa9wN3R+kvlld8sgG0nt04BAZxdCDP4t2qZ9TJsquLWA+xMtT8Waibb3d4li4AQS+IOfjiHAznv/dhHgQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.2.0.tgz", + "integrity": "sha512-ARy4BUTMU+S0ZI6605NDqfWO+qZqV2d/xfY32z3hVSsd9IaAKJBZ1ILTZLy87oIjW8+gUpQmk9Kt0ZP9bmmd8Q==", "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.37.3", "fast-deep-equal": "^3.1.3", "ts-mixer": "^6.0.1", "tslib": "^2.4.0" @@ -52,69 +52,71 @@ } }, "node_modules/@discordjs/collection": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.7.0.tgz", - "integrity": "sha512-R5i8Wb8kIcBAFEPLLf7LVBQKBDYUL+ekb23sOgpkpyGT+V4P7V83wTxcsqmX+PbqHt4cEHn053uMWfRqh/Z/nA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.1.0.tgz", + "integrity": "sha512-PQ2Bv6pnT7aGPCKWbvvNRww5tYCGpggIQVgpuF9TdDPeR6n6vQYxezXiLVOS9z2B62Dp4c+qepQ15SgJbLYtCQ==", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/@discordjs/rest": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.1.0.tgz", + "integrity": "sha512-yCrthRTQeUyNThQEpCk7bvQJlwQmz6kU0tf3dcWBv2WX3Bncl41x7Wc+v5b5OsIxfNYq38PvVtWircu9jtYZug==", + "dependencies": { + "@discordjs/collection": "^1.0.1", + "@sapphire/async-queue": "^1.5.0", + "@sapphire/snowflake": "^3.2.2", + "discord-api-types": "^0.37.3", + "file-type": "^17.1.6", + "tslib": "^2.4.0", + "undici": "^5.9.1" + }, "engines": { "node": ">=16.9.0" } }, "node_modules/@sapphire/async-queue": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.1.tgz", - "integrity": "sha512-FFTlPOWZX1kDj9xCAsRzH5xEJfawg1lNoYAA+ecOWJMHOfiZYb1uXOI3ne9U4UILSEPwfE68p3T9wUHwIQfR0g==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.0.tgz", + "integrity": "sha512-JkLdIsP8fPAdh9ZZjrbHWR/+mZj0wvKS5ICibcLrRI1j84UmLMshx5n9QmL8b95d4onJ2xxiyugTgSAX7AalmA==", "engines": { "node": ">=v14.0.0", "npm": ">=7.0.0" } }, "node_modules/@sapphire/shapeshift": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.4.0.tgz", - "integrity": "sha512-uV+vErdfbxCgnjgcwkPDADlyS40I20L57YPy254LKbRNfLCg4/ymy510aNSGhLhq/dpNU0s1fQnTbI2YAetzsA==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.5.1.tgz", + "integrity": "sha512-7JFsW5IglyOIUQI1eE0g6h06D/Far6HqpcowRScgCiLSqTf3hhkPWCWotVTtVycnDCMYIwPeaw6IEPBomKC8pA==", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "lodash.uniqwith": "^4.5.0" + }, "engines": { "node": ">=v14.0.0", "npm": ">=7.0.0" } }, - "node_modules/@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "node_modules/@sapphire/snowflake": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.2.2.tgz", + "integrity": "sha512-ula2O0kpSZtX9rKXNeQMrHwNd7E4jPDJYUXmEGTFdMRfyfMw+FPyh04oKMjAiDuOi64bYgVkOV3MjK+loImFhQ==", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/is?sponsor=1" + "node": ">=v14.0.0", + "npm": ">=7.0.0" } }, + "node_modules/@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" + }, "node_modules/@types/node": { "version": "18.0.1", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.1.tgz", "integrity": "sha512-CmR8+Tsy95hhwtZBKJBs0/FFq4XX7sDZHlGGf+0q+BRZfMbOTkzkj0AFAuTyXbObDIoanaBBW0+KEW+m3N16Wg==" }, - "node_modules/@types/node-fetch": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz", - "integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", - "dependencies": { - "@types/node": "*", - "form-data": "^3.0.0" - } - }, - "node_modules/@types/node-fetch/node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/@types/webidl-conversions": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz", @@ -142,11 +144,6 @@ "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -248,17 +245,6 @@ "text-hex": "1.0.x" } }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -280,14 +266,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/denque": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz", @@ -297,9 +275,9 @@ } }, "node_modules/discord-api-types": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.33.5.tgz", - "integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg==" + "version": "0.37.4", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.4.tgz", + "integrity": "sha512-QgqYlUokWM++hdwvAtgVNLjmFumPBzFy+uWnnfVDiwBXKm+5jXHJPk2lx2eilkv/706UpAJPLSk/uVCY9NocjA==" }, "node_modules/discord-bitfield-calculator": { "version": "1.0.0", @@ -307,23 +285,24 @@ "integrity": "sha512-I1istpckG90n/kTId2OGFLz4Bm1uaJUXx6B7CsazMo3MvoQHOsLk0OWzIRlQnOyGynr8A/q9b+6Eo+Ep0UUaCA==" }, "node_modules/discord.js": { - "version": "13.8.1", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.8.1.tgz", - "integrity": "sha512-jOsD+4tEZWWx0RHVyH+FBcqoTrsL+d5Mm5p+ULQOdU0qSaxhLNkWYig+yDHNZoND7nlkXX3qi+BW+gO5erWylg==", + "version": "14.3.0", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.3.0.tgz", + "integrity": "sha512-CpIwoAAuELiHSgVKRMzsCADS6ZlJwAZ9RlvcJYdEgS00aW36dSvXyBgE+S3pigkc7G+jU6BEalMUWIJFveqrBQ==", "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.2.0", + "@discordjs/collection": "^1.1.0", + "@discordjs/rest": "^1.1.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.37.3", + "fast-deep-equal": "^3.1.3", + "lodash.snakecase": "^4.1.1", + "tslib": "^2.4.0", + "undici": "^5.9.1", + "ws": "^8.8.1" }, "engines": { - "node": ">=16.6.0", - "npm": ">=7.0.0" + "node": ">=16.9.0" } }, "node_modules/enabled": { @@ -341,24 +320,27 @@ "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==" }, + "node_modules/file-type": { + "version": "17.1.6", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.6.tgz", + "integrity": "sha512-hlDw5Ev+9e883s0pwUsuuYNu4tD7GgpUnOvykjv1Gya0ZIjuKumthDRua90VUn6/nlRKAjcxLUnHNTIUWwWIiw==", + "dependencies": { + "readable-web-to-node-stream": "^3.0.2", + "strtok3": "^7.0.0-alpha.9", + "token-types": "^5.0.0-alpha.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/file-type?sponsor=1" + } + }, "node_modules/fn.name": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -414,6 +396,16 @@ "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" }, + "node_modules/lodash.snakecase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", + "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" + }, + "node_modules/lodash.uniqwith": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz", + "integrity": "sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q==" + }, "node_modules/logform": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/logform/-/logform-2.4.1.tgz", @@ -432,25 +424,6 @@ "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", "optional": true }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/mongodb": { "version": "4.8.1", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.8.1.tgz", @@ -522,44 +495,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, - "node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-fetch/node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "node_modules/node-fetch/node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/node-fetch/node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/one-time": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", @@ -568,6 +503,18 @@ "fn.name": "1.x.x" } }, + "node_modules/peek-readable": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz", + "integrity": "sha512-YtCKvLUOvwtMGmrniQPdO7MwPjgkFBtFIrmfSbYmYuq3tKDV/mcfAhBth1+C3ru7uXIZasc/pHnb+YDYNkkj4A==", + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -589,6 +536,21 @@ "node": ">= 6" } }, + "node_modules/readable-web-to-node-stream": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", + "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", + "dependencies": { + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -688,11 +650,43 @@ "safe-buffer": "~5.2.0" } }, + "node_modules/strtok3": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0.tgz", + "integrity": "sha512-pQ+V+nYQdC5H3Q7qBZAz/MO6lwGhoC2gOAjuouGf/VO0m7vQRh8QNMl2Uf6SwAtzZ9bOw3UIeBukEGNJl5dtXQ==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^5.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, "node_modules/text-hex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" }, + "node_modules/token-types": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz", + "integrity": "sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, "node_modules/tr46": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", @@ -719,6 +713,14 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, + "node_modules/undici": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.10.0.tgz", + "integrity": "sha512-c8HsD3IbwmjjbLvoZuRI26TZic+TSEe8FPMLLOkN1AfYRhdjnKBU6yL+IwcSCbdZiX4e5t0lfMDLDCqj4Sq70g==", + "engines": { + "node": ">=12.18" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -778,9 +780,9 @@ } }, "node_modules/ws": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.0.tgz", - "integrity": "sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.1.tgz", + "integrity": "sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==", "engines": { "node": ">=10.0.0" }, @@ -815,64 +817,65 @@ } }, "@discordjs/builders": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.14.0.tgz", - "integrity": "sha512-+fqLIqa9wN3R+kvlld8sgG0nt04BAZxdCDP4t2qZ9TJsquLWA+xMtT8Waibb3d4li4AQS+IOfjiHAznv/dhHgQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.2.0.tgz", + "integrity": "sha512-ARy4BUTMU+S0ZI6605NDqfWO+qZqV2d/xfY32z3hVSsd9IaAKJBZ1ILTZLy87oIjW8+gUpQmk9Kt0ZP9bmmd8Q==", "requires": { - "@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.37.3", "fast-deep-equal": "^3.1.3", "ts-mixer": "^6.0.1", "tslib": "^2.4.0" } }, "@discordjs/collection": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.7.0.tgz", - "integrity": "sha512-R5i8Wb8kIcBAFEPLLf7LVBQKBDYUL+ekb23sOgpkpyGT+V4P7V83wTxcsqmX+PbqHt4cEHn053uMWfRqh/Z/nA==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.1.0.tgz", + "integrity": "sha512-PQ2Bv6pnT7aGPCKWbvvNRww5tYCGpggIQVgpuF9TdDPeR6n6vQYxezXiLVOS9z2B62Dp4c+qepQ15SgJbLYtCQ==" + }, + "@discordjs/rest": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.1.0.tgz", + "integrity": "sha512-yCrthRTQeUyNThQEpCk7bvQJlwQmz6kU0tf3dcWBv2WX3Bncl41x7Wc+v5b5OsIxfNYq38PvVtWircu9jtYZug==", + "requires": { + "@discordjs/collection": "^1.0.1", + "@sapphire/async-queue": "^1.5.0", + "@sapphire/snowflake": "^3.2.2", + "discord-api-types": "^0.37.3", + "file-type": "^17.1.6", + "tslib": "^2.4.0", + "undici": "^5.9.1" + } }, "@sapphire/async-queue": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.1.tgz", - "integrity": "sha512-FFTlPOWZX1kDj9xCAsRzH5xEJfawg1lNoYAA+ecOWJMHOfiZYb1uXOI3ne9U4UILSEPwfE68p3T9wUHwIQfR0g==" + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.0.tgz", + "integrity": "sha512-JkLdIsP8fPAdh9ZZjrbHWR/+mZj0wvKS5ICibcLrRI1j84UmLMshx5n9QmL8b95d4onJ2xxiyugTgSAX7AalmA==" }, "@sapphire/shapeshift": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.4.0.tgz", - "integrity": "sha512-uV+vErdfbxCgnjgcwkPDADlyS40I20L57YPy254LKbRNfLCg4/ymy510aNSGhLhq/dpNU0s1fQnTbI2YAetzsA==" + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.5.1.tgz", + "integrity": "sha512-7JFsW5IglyOIUQI1eE0g6h06D/Far6HqpcowRScgCiLSqTf3hhkPWCWotVTtVycnDCMYIwPeaw6IEPBomKC8pA==", + "requires": { + "fast-deep-equal": "^3.1.3", + "lodash.uniqwith": "^4.5.0" + } }, - "@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==" + "@sapphire/snowflake": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.2.2.tgz", + "integrity": "sha512-ula2O0kpSZtX9rKXNeQMrHwNd7E4jPDJYUXmEGTFdMRfyfMw+FPyh04oKMjAiDuOi64bYgVkOV3MjK+loImFhQ==" + }, + "@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" }, "@types/node": { "version": "18.0.1", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.1.tgz", "integrity": "sha512-CmR8+Tsy95hhwtZBKJBs0/FFq4XX7sDZHlGGf+0q+BRZfMbOTkzkj0AFAuTyXbObDIoanaBBW0+KEW+m3N16Wg==" }, - "@types/node-fetch": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz", - "integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", - "requires": { - "@types/node": "*", - "form-data": "^3.0.0" - }, - "dependencies": { - "form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - } - } - }, "@types/webidl-conversions": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz", @@ -900,11 +903,6 @@ "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -972,14 +970,6 @@ "text-hex": "1.0.x" } }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -995,20 +985,15 @@ } } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" - }, "denque": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz", "integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ==" }, "discord-api-types": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.33.5.tgz", - "integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg==" + "version": "0.37.4", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.4.tgz", + "integrity": "sha512-QgqYlUokWM++hdwvAtgVNLjmFumPBzFy+uWnnfVDiwBXKm+5jXHJPk2lx2eilkv/706UpAJPLSk/uVCY9NocjA==" }, "discord-bitfield-calculator": { "version": "1.0.0", @@ -1016,19 +1001,21 @@ "integrity": "sha512-I1istpckG90n/kTId2OGFLz4Bm1uaJUXx6B7CsazMo3MvoQHOsLk0OWzIRlQnOyGynr8A/q9b+6Eo+Ep0UUaCA==" }, "discord.js": { - "version": "13.8.1", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.8.1.tgz", - "integrity": "sha512-jOsD+4tEZWWx0RHVyH+FBcqoTrsL+d5Mm5p+ULQOdU0qSaxhLNkWYig+yDHNZoND7nlkXX3qi+BW+gO5erWylg==", + "version": "14.3.0", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.3.0.tgz", + "integrity": "sha512-CpIwoAAuELiHSgVKRMzsCADS6ZlJwAZ9RlvcJYdEgS00aW36dSvXyBgE+S3pigkc7G+jU6BEalMUWIJFveqrBQ==", "requires": { - "@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.2.0", + "@discordjs/collection": "^1.1.0", + "@discordjs/rest": "^1.1.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.37.3", + "fast-deep-equal": "^3.1.3", + "lodash.snakecase": "^4.1.1", + "tslib": "^2.4.0", + "undici": "^5.9.1", + "ws": "^8.8.1" } }, "enabled": { @@ -1046,21 +1033,21 @@ "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==" }, + "file-type": { + "version": "17.1.6", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.6.tgz", + "integrity": "sha512-hlDw5Ev+9e883s0pwUsuuYNu4tD7GgpUnOvykjv1Gya0ZIjuKumthDRua90VUn6/nlRKAjcxLUnHNTIUWwWIiw==", + "requires": { + "readable-web-to-node-stream": "^3.0.2", + "strtok3": "^7.0.0-alpha.9", + "token-types": "^5.0.0-alpha.2" + } + }, "fn.name": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" }, - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -1096,6 +1083,16 @@ "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" }, + "lodash.snakecase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", + "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" + }, + "lodash.uniqwith": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz", + "integrity": "sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q==" + }, "logform": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/logform/-/logform-2.4.1.tgz", @@ -1114,19 +1111,6 @@ "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", "optional": true }, - "mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" - }, - "mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "requires": { - "mime-db": "1.52.0" - } - }, "mongodb": { "version": "4.8.1", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.8.1.tgz", @@ -1180,35 +1164,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "requires": { - "whatwg-url": "^5.0.0" - }, - "dependencies": { - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - } - } - }, "one-time": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", @@ -1217,6 +1172,11 @@ "fn.name": "1.x.x" } }, + "peek-readable": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz", + "integrity": "sha512-YtCKvLUOvwtMGmrniQPdO7MwPjgkFBtFIrmfSbYmYuq3tKDV/mcfAhBth1+C3ru7uXIZasc/pHnb+YDYNkkj4A==" + }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -1232,6 +1192,14 @@ "util-deprecate": "^1.0.1" } }, + "readable-web-to-node-stream": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", + "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", + "requires": { + "readable-stream": "^3.6.0" + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -1300,11 +1268,29 @@ "safe-buffer": "~5.2.0" } }, + "strtok3": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0.tgz", + "integrity": "sha512-pQ+V+nYQdC5H3Q7qBZAz/MO6lwGhoC2gOAjuouGf/VO0m7vQRh8QNMl2Uf6SwAtzZ9bOw3UIeBukEGNJl5dtXQ==", + "requires": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^5.0.0" + } + }, "text-hex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" }, + "token-types": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz", + "integrity": "sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg==", + "requires": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + } + }, "tr46": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", @@ -1328,6 +1314,11 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, + "undici": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.10.0.tgz", + "integrity": "sha512-c8HsD3IbwmjjbLvoZuRI26TZic+TSEe8FPMLLOkN1AfYRhdjnKBU6yL+IwcSCbdZiX4e5t0lfMDLDCqj4Sq70g==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -1375,9 +1366,9 @@ } }, "ws": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.0.tgz", - "integrity": "sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.1.tgz", + "integrity": "sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==", "requires": {} } } diff --git a/package.json b/package.json index 63fc267..1f9d45c 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,10 @@ "author": "Braeden Sowinski", "license": "ISC", "dependencies": { + "@discordjs/rest": "^1.1.0", "colors": "^1.4.0", "discord-bitfield-calculator": "^1.0.0", - "discord.js": "^13.8.1", + "discord.js": "^14.3.0", "mongodb": "^4.7.0", "mongoose": "^6.4.2", "winston": "^3.8.1" diff --git a/structures/QuarksBot.js b/structures/QuarksBot.js index 427e06f..753021c 100644 --- a/structures/QuarksBot.js +++ b/structures/QuarksBot.js @@ -1,5 +1,6 @@ -const { Collection, Client, MessageEmbed } = require('discord.js'); +const { Collection, Client, EmbedBuilder, Routes } = require('discord.js'); const MongoClient = require('mongodb').MongoClient; +const { REST } = require('@discordjs/rest'); const mongoose = require('mongoose'); const Logger = require("../util/Logger"); const path = require("path"); @@ -41,19 +42,19 @@ class QuarksBot extends Client { //Easy to send respnose so ;) interaction.guild = await this.guilds.fetch(interaction.guild_id); interaction.send = async (message) => { - return await this.api - .interactions(interaction.id, interaction.token) - .callback.post({ - data: { - type: 4, - data: - typeof message == "string" - ? { content: message, ...(message.ephemeral && {flags: (1 << 6)}), } - : message.embeds[0] && message.embeds[0].type === "rich" - ? { embeds: message.embeds, ...(message.ephemeral && {flags: (1 << 6)}), } - : { message, ...(message.ephemeral && {flags: (1 << 6)}), }, - } - }); + const rest = new REST({ version: '10' }).setToken(client.config.Token); + + return await rest.post(Routes.interactionCallback(interaction.id, interaction.token), { + body: { + type: 4, + // data: typeof message == "string" + // ? { content: message, ...(message.ephemeral && {flags: (1 << 6)}), } + // : message.embeds[0] && message.embeds[0].type === "rich" + // ? { embeds: message.embeds, ...(message.ephemeral && {flags: (1 << 6)}), } + // : { message, ...(message.ephemeral && {flags: (1 << 6)}), }, + data: message, + } + }); }; let cmd = client.commands.get(command); if ((cmd.name == 'ping' || cmd.name == 'stats') && cmd.SlashCommand && cmd.SlashCommand.run) cmd.SlashCommand.run(this, interaction, args, { GuildDB }, start); @@ -122,7 +123,7 @@ class QuarksBot extends Client { } sendTime(Channel, Error) { - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setColor(this.config.EmbedColor) .setDescription(Error); @@ -186,10 +187,14 @@ class QuarksBot extends Client { this.logger.log(Text); } + error(Text) { + this.logger.error(Text); + } + sendError(Channel, Error) { - let embed = new MessageEmbed() + let embed = new EmbedBuilder() .setTitle("An error occured") - .setColor("RED") + .setColor(client.config.Colors.Red) .setDescription(Error) Channel.send(embed); diff --git a/structures/inventory.js b/structures/inventory.js index e341c71..c9ec412 100644 --- a/structures/inventory.js +++ b/structures/inventory.js @@ -23,6 +23,7 @@ inventorySchema.methods.createInventory = function (userID, guildID) { }], lastWork: new Date('2000-01-01T00:00:00') // garantee's they can work right after inventory create, }; + this.inventory.guilds = {}; this.inventory.guilds[guildID] = newGuild }; diff --git a/util/Logger.js b/util/Logger.js index 68c24b4..c7dbaf9 100644 --- a/util/Logger.js +++ b/util/Logger.js @@ -23,6 +23,22 @@ class Logger { ) + colors.yellow(" | Info: " + Text) ); } + + error(Text) { + let d = new Date(); + this.logger.log({ + level: "error", + message: + `${d.getHours()}:${ + d.getMinutes + } - ${d.getDate()}:${d.getMonth()}:${d.getFullYear()} | Error: ` + Text, + }); + console.log( + colors.green( + `${d.getDate()}:${d.getMonth()}:${d.getFullYear()} - ${d.getHours()}:${d.getMinutes()}` + ) + colors.yellow(" | Error: ") + colors.red(Text) + ); + } } module.exports = Logger; \ No newline at end of file diff --git a/util/RegisterSlashCommands.js b/util/RegisterSlashCommands.js index e48545b..0d4acfd 100644 --- a/util/RegisterSlashCommands.js +++ b/util/RegisterSlashCommands.js @@ -1,36 +1,39 @@ const fs = require("fs"); const path = require("path"); +const { Routes } = require('discord.js'); +const { REST } = require('@discordjs/rest'); /** * Register slash commands for a guild * @param {require("../structures/QuarksBot")} client * @param {string} guild */ -module.exports = (client, guild) => { - - let commandsDir = path.join(__dirname, "..", "commands"); +module.exports = async function(client, guild) { - fs.readdir(commandsDir, (err, files) => { - if (err) throw err; - files.forEach(async (file) => { - let cmd = require(commandsDir + "/" + file); - if (!cmd.SlashCommand || !cmd.SlashCommand.run) return; - let dataStuff = { - name: cmd.name, - description: cmd.description, - options: cmd.SlashCommand.options, - }; + const commands = []; + const commandFiles = fs.readdirSync(path.join(__dirname, "..", "commands")).filter(file => file.endsWith('.js')); - //Creating variables like this, So you might understand my code :) - let ClientAPI = client.api.applications(client.user.id); - let GuildAPI = ClientAPI.guilds(guild); + // Place your client and guild ids here + const clientId = client.application.id; + const guildId = guild; - try { - await GuildAPI.commands.post({ data: dataStuff }); - } catch (e) { - if (client.config.Dev == 'DEV.') console.log(e); - client.log('Error: API missing permissions, re-invite the bot'); - } - }); - }); + for (const file of commandFiles) { + const command = require(`../commands/${file}`); + commands.push(command); + } + + const rest = new REST({ version: '10' }).setToken(client.config.Token); + + try { + client.log('Started refreshing application (/) commands.'); + + await rest.put( + Routes.applicationGuildCommands(clientId, guildId), + { body: commands }, + ); + + client.log('Successfully reloaded application (/) commands.'); + } catch (error) { + client.error(error); + } }; \ No newline at end of file