upgrade to discord.js v14
This commit is contained in:
24 files changed
+1598
-1560
No files matched your search
+29
-16
@@ -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.`)
|
||||
|
||||
|
||||
Reference in new issue
Block a user