12.8.3 fix internal error handling

This commit is contained in:
SowinskiBraeden committed 2022-10-16 13:07:32 -07:00
1 parent 060ef78db4
commit dad2cddf61
12 files changed
+211 -74

No files matched your search

+20 -20
View File
@@ -133,14 +133,14 @@ module.exports = {
let newBank = new Bank(); let newBank = new Bank();
newBank.createBank(interaction.member.user.id, GuildDB.serverID, GuildDB.startingBalance); newBank.createBank(interaction.member.user.id, GuildDB.serverID, GuildDB.startingBalance);
newBank.save().catch(err => { newBank.save().catch(err => {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else banking = banking.banking; } else banking = banking.banking;
if (!client.exists(banking.guilds[GuildDB.serverID])) { if (!client.exists(banking.guilds[GuildDB.serverID])) {
const success = addBank(banking.guilds, GuildDB.serverID, interaction.member.user.id, client, GuildDB.startingBalance); const success = addBank(banking.guilds, GuildDB.serverID, interaction.member.user.id, client, GuildDB.startingBalance);
if (!success) return client.sendInternalError('Failed to add bank'); if (!success) return client.sendInternalError(interaction, 'Failed to add bank');
} }
let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory); let inventory = await client.dbo.collection("inventories").findOne({"inventory.userID": interaction.member.user.id}).then(inventory => inventory);
@@ -176,7 +176,7 @@ module.exports = {
if (!client.exists(inventory.guilds[GuildDB.serverID])) { if (!client.exists(inventory.guilds[GuildDB.serverID])) {
const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client); const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client);
if (!success) return client.sendInternalError('Failed to add inventory'); if (!success) return client.sendInternalError(interaction, 'Failed to add inventory');
} }
if (args[0].name == 'deposit') { if (args[0].name == 'deposit') {
@@ -192,7 +192,7 @@ module.exports = {
const newCash = Math.abs(banking.guilds[GuildDB.serverID].account.cash.toFixed(2) - args[0].options[0].value); const newCash = Math.abs(banking.guilds[GuildDB.serverID].account.cash.toFixed(2) - args[0].options[0].value);
client.dbo.collection("banks").updateOne({"banking.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance,[`banking.guilds.${GuildDB.serverID}.account.cash`]:newCash}}, function(err, res) { client.dbo.collection("banks").updateOne({"banking.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) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
client.dbo.collection("inventories").updateOne( client.dbo.collection("inventories").updateOne(
{ {
@@ -204,7 +204,7 @@ module.exports = {
[`inventory.guilds.${GuildDB.serverID}.items.$.cash`]: newCash [`inventory.guilds.${GuildDB.serverID}.items.$.cash`]: newCash
} }
}, function(err, res) { }, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -227,7 +227,7 @@ module.exports = {
const newCash = banking.guilds[GuildDB.serverID].account.cash + args[0].options[0].value; const newCash = banking.guilds[GuildDB.serverID].account.cash + args[0].options[0].value;
client.dbo.collection("banks").updateOne({"banking.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance,[`banking.guilds.${GuildDB.serverID}.account.cash`]:newCash}}, function(err, res) { client.dbo.collection("banks").updateOne({"banking.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) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
client.dbo.collection("inventories").updateOne( client.dbo.collection("inventories").updateOne(
{ {
@@ -239,7 +239,7 @@ module.exports = {
[`inventory.guilds.${GuildDB.serverID}.items.$.cash`]: newCash [`inventory.guilds.${GuildDB.serverID}.items.$.cash`]: newCash
} }
}, function(err, res) { }, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -276,14 +276,14 @@ module.exports = {
let newBank = new Bank(); let newBank = new Bank();
newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance); newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance);
newBank.save().catch(err => { newBank.save().catch(err => {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else targetUserBanking = targetUserBanking.banking; } else targetUserBanking = targetUserBanking.banking;
if (!client.exists(targetUserBanking.guilds[GuildDB.serverID])) { if (!client.exists(targetUserBanking.guilds[GuildDB.serverID])) {
const success = addBank(targetUserBanking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance); const success = addBank(targetUserBanking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance);
if (!success) return client.sendInternalError('Failed to add bank'); if (!success) return client.sendInternalError(interaction, 'Failed to add bank');
} }
// This lame line of code to get username without ping on discord // This lame line of code to get username without ping on discord
@@ -320,7 +320,7 @@ module.exports = {
const newCash = banking.guilds[GuildDB.serverID].account.cash - args[0].options[1].value; const newCash = banking.guilds[GuildDB.serverID].account.cash - args[0].options[1].value;
client.dbo.collection("banks").updateOne({"banking.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.cash`]:newCash}}, function(err, res) { client.dbo.collection("banks").updateOne({"banking.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.cash`]:newCash}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
client.dbo.collection("inventories").updateOne( client.dbo.collection("inventories").updateOne(
@@ -333,7 +333,7 @@ module.exports = {
[`inventory.guilds.${GuildDB.serverID}.items.$.cash`] :newCash [`inventory.guilds.${GuildDB.serverID}.items.$.cash`] :newCash
} }
}, function(err, res) { }, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const targetUserID = args[0].options[0].value.replace('<@!', '').replace('>', ''); const targetUserID = args[0].options[0].value.replace('<@!', '').replace('>', '');
@@ -365,13 +365,13 @@ module.exports = {
newInventory.createInventory(targetUserID, GuildDB.serverID); newInventory.createInventory(targetUserID, GuildDB.serverID);
newInventory.inventory.guilds[GuildDB.serverID].items[0].cash = args[0].options[1].value; newInventory.inventory.guilds[GuildDB.serverID].items[0].cash = args[0].options[1].value;
newInventory.save().catch(err => { newInventory.save().catch(err => {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else targetUserInventory = targetUserInventory.inventory; } else targetUserInventory = targetUserInventory.inventory;
if (!client.exists(targetUserInventory.guilds[GuildDB.serverID])) { if (!client.exists(targetUserInventory.guilds[GuildDB.serverID])) {
const success = addInventory(targetUserInventory.guilds, GuildDB.serverID, targetUserID, client); const success = addInventory(targetUserInventory.guilds, GuildDB.serverID, targetUserID, client);
if (!success) return client.sendInternalError('Failed to add inventory'); if (!success) return client.sendInternalError(interaction, 'Failed to add inventory');
} }
const newTargetCash = targetUserInventory.inventory.guilds[GuildDB.serverID].items[0].cash + args[0].options[1].value; const newTargetCash = targetUserInventory.inventory.guilds[GuildDB.serverID].items[0].cash + args[0].options[1].value;
@@ -385,7 +385,7 @@ module.exports = {
[`inventory.guilds.${GuildDB.serverID}.items.$.cash`]: newTargetCash [`inventory.guilds.${GuildDB.serverID}.items.$.cash`]: newTargetCash
} }
}, function(err, res) { }, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
let targetUserBanking = await client.dbo.collection("banks").findOne({"banking.userID": targetUserID}).then(banking => banking); let targetUserBanking = await client.dbo.collection("banks").findOne({"banking.userID": targetUserID}).then(banking => banking);
@@ -407,17 +407,17 @@ module.exports = {
let newBank = new Bank(); let newBank = new Bank();
newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance); newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance);
newBank.save().catch(err => { newBank.save().catch(err => {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else targetUserBanking = targetUserBanking.banking; } else targetUserBanking = targetUserBanking.banking;
if (!client.exists(targetUserBanking.guilds[GuildDB.serverID])) { if (!client.exists(targetUserBanking.guilds[GuildDB.serverID])) {
const success = addBank(targetUserBanking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance); const success = addBank(targetUserBanking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance);
if (!success) return client.sendInternalError('Failed to add bank'); if (!success) return client.sendInternalError(interaction, 'Failed to add bank');
} }
client.dbo.collection("banks").updateOne({"banking.userID": targetUserID}, {$set: {[`banking.guilds.${GuildDB.serverID}.account.cash`]: newTargetCash}}, function(err, res) { client.dbo.collection("banks").updateOne({"banking.userID": targetUserID}, {$set: {[`banking.guilds.${GuildDB.serverID}.account.cash`]: newTargetCash}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -441,7 +441,7 @@ module.exports = {
const newBalance = banking.guilds[GuildDB.serverID].account.balance - args[0].options[1].value; const newBalance = banking.guilds[GuildDB.serverID].account.balance - args[0].options[1].value;
client.dbo.collection("banks").updateOne({"banking.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance}}, function(err, res) { client.dbo.collection("banks").updateOne({"banking.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const targetUserID = args[0].options[0].value.replace('<@!', '').replace('>', ''); const targetUserID = args[0].options[0].value.replace('<@!', '').replace('>', '');
@@ -461,14 +461,14 @@ module.exports = {
} }
client.dbo.collection("banks").insertOne(targetUserBanking, function(err, res) { client.dbo.collection("banks").insertOne(targetUserBanking, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else targetUserBanking = targetUserBanking.banking; } else targetUserBanking = targetUserBanking.banking;
const newTargetBalance = targetUserBanking.guilds[GuildDB.serverID].account.balance + args[0].options[1].value; const newTargetBalance = targetUserBanking.guilds[GuildDB.serverID].account.balance + args[0].options[1].value;
client.dbo.collection("banks").updateOne({"banking.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newTargetBalance}}, function(err, res) { client.dbo.collection("banks").updateOne({"banking.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newTargetBalance}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
+25 -25
View File
@@ -395,7 +395,7 @@ module.exports = {
if (error) return interaction.send({ embeds: [errorEmbed] }); if (error) return interaction.send({ embeds: [errorEmbed] });
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$push:{"server.allowedChannels": channelid}}, function (err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$push:{"server.allowedChannels": channelid}}, function (err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -442,7 +442,7 @@ module.exports = {
if (channelSetting == channelid) return interaction.send({ embeds: [presetEmbed] }); 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) { client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.actionChannel":channelid}},function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -481,7 +481,7 @@ module.exports = {
if (channelSetting == channelid) return interaction.send({ embeds: [presetEmbed] }); 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) { client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.tweetChannel":channelid}},function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -520,7 +520,7 @@ module.exports = {
if (channelSetting == channelid) return interaction.send({ embeds: [presetEmbed] }); 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) { client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.advertsChannel":channelid}},function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -560,7 +560,7 @@ module.exports = {
if (channelSetting == channelid) return interaction.send({ embeds: [presetEmbed] }); 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) { client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.dispatchChannel":channelid}},function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -590,7 +590,7 @@ module.exports = {
} else if (args[0].name == 'starting_balance') { } else if (args[0].name == 'starting_balance') {
client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {$set: {"server.startingBalance":args[0].options[0].value}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {$set: {"server.startingBalance":args[0].options[0].value}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
let successEmbed = new EmbedBuilder() let successEmbed = new EmbedBuilder()
@@ -619,7 +619,7 @@ module.exports = {
} }
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$push: {"server.incomeRoles":newIncome}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$push: {"server.incomeRoles":newIncome}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else { } else {
client.dbo.collection("guilds").updateOne({ client.dbo.collection("guilds").updateOne({
@@ -631,7 +631,7 @@ module.exports = {
"server.incomeRoles.$.income": args[0].options[0].options[1].value "server.incomeRoles.$.income": args[0].options[0].options[1].value
} }
}, function(err, res) { }, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} }
const perform = searchIndex == -1 ? 'set' : 'updated'; const perform = searchIndex == -1 ? 'set' : 'updated';
@@ -676,7 +676,7 @@ module.exports = {
const roleId = args[0].options[0].options[0].value; const roleId = args[0].options[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.commercialRole": roleId}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.commercialRole": roleId}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -711,7 +711,7 @@ module.exports = {
if (args[0].options[0].name== 'set') { if (args[0].options[0].name== 'set') {
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.officerRole": roleId}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.officerRole": roleId}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -746,7 +746,7 @@ module.exports = {
const roleId = args[0].options[0].options[0].value; const roleId = args[0].options[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.dispatcherRole": roleId}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.dispatcherRole": roleId}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -782,7 +782,7 @@ module.exports = {
const roleId = args[0].options[0].options[0].value; const roleId = args[0].options[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.botAdmin": roleId}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.botAdmin": roleId}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -814,7 +814,7 @@ module.exports = {
} else if (args[0].name == 'only_officers_search') { } else if (args[0].name == 'only_officers_search') {
const setting = args[0].options[0]; const setting = args[0].options[0];
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.onlyOfficersSearch": setting}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.onlyOfficersSearch": setting}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const title = setting ? 'True: Only officers can use /search' : 'False: Any user can use /search'; const title = setting ? 'True: Only officers can use /search' : 'False: Any user can use /search';
@@ -826,7 +826,7 @@ module.exports = {
return interaction.send({ embeds: [successEmbed] }); return interaction.send({ embeds: [successEmbed] });
} else if (args[0].name == 'casino_multiplier') { } else if (args[0].name == 'casino_multiplier') {
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.casinoMultiplier": args[0].options[0]}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.casinoMultiplier": args[0].options[0]}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
@@ -917,7 +917,7 @@ module.exports = {
if (interaction.customId.split('-')[1]=='yes') { if (interaction.customId.split('-')[1]=='yes') {
action = 'removed'; action = 'removed';
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull:{"server.allowedChannels": channelid}}, function (err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull:{"server.allowedChannels": channelid}}, function (err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (interaction.customId.split('-')[1]=='no') action = 'kept'; } else if (interaction.customId.split('-')[1]=='no') action = 'kept';
@@ -941,7 +941,7 @@ module.exports = {
if (interaction.customId.split('-')[1]=='yes') { if (interaction.customId.split('-')[1]=='yes') {
action = 'removed'; action = 'removed';
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.actionChannel": null}},function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.actionChannel": null}},function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (queryString==`no-${interaction.member.user.id}`) action = 'kept'; } else if (queryString==`no-${interaction.member.user.id}`) action = 'kept';
@@ -965,7 +965,7 @@ module.exports = {
if (interaction.customId.split('-')[1]=='yes') { if (interaction.customId.split('-')[1]=='yes') {
action = 'removed'; action = 'removed';
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.tweetChannel": null}},function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.tweetChannel": null}},function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (interaction.customId.split('-')[1]=='no') action = 'kept'; } else if (interaction.customId.split('-')[1]=='no') action = 'kept';
@@ -989,7 +989,7 @@ module.exports = {
if (interaction.customId.split('-')[1]=='yes') { if (interaction.customId.split('-')[1]=='yes') {
action = 'removed'; action = 'removed';
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.advertsChannel": null}},function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.advertsChannel": null}},function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (interaction.customId.split('-')[1]=='no') action = 'kept'; } else if (interaction.customId.split('-')[1]=='no') action = 'kept';
@@ -1013,7 +1013,7 @@ module.exports = {
if (interaction.customId.split('-')[1]=='yes') { if (interaction.customId.split('-')[1]=='yes') {
action = 'removed'; action = 'removed';
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.dispatchChannel": null}},function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.dispatchChannel": null}},function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (interaction.customId.split('-')[1]=='no') action = 'kept'; } else if (interaction.customId.split('-')[1]=='no') action = 'kept';
@@ -1037,7 +1037,7 @@ module.exports = {
if (interaction.customId.split('-')[1]=='yes') { if (interaction.customId.split('-')[1]=='yes') {
action = 'removed'; action = 'removed';
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull: {"server.incomeRoles": roleId}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull: {"server.incomeRoles": roleId}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (interaction.customId.split('-')[1]=='no') action = 'kept'; } else if (interaction.customId.split('-')[1]=='no') action = 'kept';
@@ -1061,7 +1061,7 @@ module.exports = {
if (interaction.customId.split('-')[1]=='yes') { if (interaction.customId.split('-')[1]=='yes') {
action = 'removed'; action = 'removed';
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.commercialRole": null}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.commercialRole": null}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (interaction.customId.split('-')[1]=='no') action = 'kept'; } else if (interaction.customId.split('-')[1]=='no') action = 'kept';
@@ -1085,7 +1085,7 @@ module.exports = {
if (interaction.customId.split('-')[1]=='no') { if (interaction.customId.split('-')[1]=='no') {
action = 'removed'; action = 'removed';
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.officerRole": null}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.officerRole": null}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (interaction.customId.split('-')[1]=='no') action = 'kept'; } else if (interaction.customId.split('-')[1]=='no') action = 'kept';
@@ -1109,7 +1109,7 @@ module.exports = {
if (interaction.customId.split('-')[1]=='yes') { if (interaction.customId.split('-')[1]=='yes') {
action = 'removed'; action = 'removed';
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.dispatcherRole": null}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.dispatcherRole": null}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (interaction.customId.split('-')[1]=='no') action = 'kept'; } else if (interaction.customId.split('-')[1]=='no') action = 'kept';
@@ -1133,7 +1133,7 @@ module.exports = {
if (interaction.customId.split('-')[1]=='yes') { if (interaction.customId.split('-')[1]=='yes') {
action = 'removed'; action = 'removed';
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.botAdmin": null}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.botAdmin": null}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (interaction.customId.split('-')[1]=='no') action = 'kept'; } else if (interaction.customId.split('-')[1]=='no') action = 'kept';
@@ -1172,7 +1172,7 @@ module.exports = {
onlyOfficersSearch: false, onlyOfficersSearch: false,
} }
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server": defaultGuildConfig}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server": defaultGuildConfig}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (interaction.customId.split('-')[1]=='no') action = 'kept'; } else if (interaction.customId.split('-')[1]=='no') action = 'kept';
+3 -3
View File
@@ -77,20 +77,20 @@ module.exports = {
let newBank = new Bank(); let newBank = new Bank();
newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance); newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance);
newBank.save().catch(err => { newBank.save().catch(err => {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else banking = banking.banking; } else banking = banking.banking;
if (!client.exists(banking.guilds[GuildDB.serverID])) { if (!client.exists(banking.guilds[GuildDB.serverID])) {
const success = addBank(banking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance); const success = addBank(banking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance);
if (!success) return client.sendInternalError('Failed to add bank'); if (!success) return client.sendInternalError(interaction, 'Failed to add bank');
} }
const newTargetBalance = banking.guilds[GuildDB.serverID].account.balance - args[0].options[1].value; const newTargetBalance = banking.guilds[GuildDB.serverID].account.balance - args[0].options[1].value;
client.dbo.collection("banks").updateOne({"banking.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newTargetBalance}}, function(err, res) { client.dbo.collection("banks").updateOne({"banking.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newTargetBalance}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
+9 -9
View File
@@ -181,13 +181,13 @@ module.exports = {
let newInventory = new Inventory(); let newInventory = new Inventory();
newInventory.createInventory(interaction.member.user.id, GuildDB.serverID); newInventory.createInventory(interaction.member.user.id, GuildDB.serverID);
newInventory.save().catch(err => { newInventory.save().catch(err => {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else inventory = inventory.inventory } else inventory = inventory.inventory
if (!client.exists(inventory.guilds[GuildDB.serverID])) { if (!client.exists(inventory.guilds[GuildDB.serverID])) {
const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client); const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client);
if (!success) return client.sendInternalError('Failed to add inventory'); if (!success) return client.sendInternalError(interaction, 'Failed to add inventory');
} }
if (args[0].name == 'view') { if (args[0].name == 'view') {
@@ -251,7 +251,7 @@ module.exports = {
} }
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$push: {[`inventory.guilds.${GuildDB.serverID}.items`]: firearm}}, function(err, res) { client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$push: {[`inventory.guilds.${GuildDB.serverID}.items`]: firearm}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
let message = new EmbedBuilder() let message = new EmbedBuilder()
@@ -271,7 +271,7 @@ module.exports = {
} }
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$push: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) { client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$push: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
let message = new EmbedBuilder() let message = new EmbedBuilder()
@@ -454,7 +454,7 @@ module.exports = {
let item = inventory.guilds[GuildDB.serverID].items[args[0].options[0].value-1]; let item = inventory.guilds[GuildDB.serverID].items[args[0].options[0].value-1];
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) { client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
let message = new EmbedBuilder() let message = new EmbedBuilder()
.setTitle(`You ${dropActions[Math.floor(Math.random() * dropActions.length)]} your ${item.name}`) .setTitle(`You ${dropActions[Math.floor(Math.random() * dropActions.length)]} your ${item.name}`)
@@ -487,7 +487,7 @@ module.exports = {
newInventory.createInventory(targetUserID, GuildDB.serverID); newInventory.createInventory(targetUserID, GuildDB.serverID);
newInventory.addItem(item); newInventory.addItem(item);
newInventory.save().catch(err => { newInventory.save().catch(err => {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else { } else {
targetUserInventory = targetUserIventory.inventory; targetUserInventory = targetUserIventory.inventory;
@@ -504,10 +504,10 @@ module.exports = {
} }
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) { client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
client.dbo.collection('inventories').updateOne({'inventory.userID': targetUserID}, {$push: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) { client.dbo.collection('inventories').updateOne({'inventory.userID': targetUserID}, {$push: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} }
@@ -534,7 +534,7 @@ module.exports = {
action = 'cleared'; action = 'cleared';
const tempWallet = inventory.guilds[GuildDB.serverID].items[0]; const tempWallet = inventory.guilds[GuildDB.serverID].items[0];
client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id},{$set:{[`inventory.guilds.${GuildDB.serverID}.items`]: [tempWallet]}},function(err, res) { client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id},{$set:{[`inventory.guilds.${GuildDB.serverID}.items`]: [tempWallet]}},function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (queryString==`inventoryClear-no-${interaction.member.user.id}`) action = 'kept'; } else if (queryString==`inventoryClear-no-${interaction.member.user.id}`) action = 'kept';
+137
View File
@@ -0,0 +1,137 @@
const { EmbedBuilder } = require('discord.js');
const { Invoice, addInvoiceList, addInvoice } = require('../structures/invoice');
module.exports = {
name: "invoice",
debug: false,
description: "handle invoices",
usage: "[cmd] [opt]",
permissions: {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [],
},
options: [
{
name: "list",
description: "list invoices that have been sent to you",
value: "list",
type: 1,
},
{
name: "create",
description: "send an invoice to a user",
value: "create",
type: 1,
options: [
{
name: "title",
description: "title of the invoice",
value: "title",
type: 3,
required: true,
},
{
name: "description",
description: "description of the invoice",
value: "description",
type: 3,
required: true,
},
{
name: "user",
description: "user to send invoice to",
value: "user",
type: 6,
required: true,
},
{
name: "fee",
description: "the amount due for this invoice",
value: "fee",
type: 10,
min_value: 0.01,
required: true,
}
]
}
],
SlashCommand: {
/**
*
* @param {require("../structures/QuarksBot")} client
* @param {import("discord.js").MessageCreate} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus && !GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
}
if (args[0].name == 'list') {
console.log('list');
} else if (args[0].name == 'create') {
if (!client.exists(GuildDB.commercialRole)) {
let embed = new EmbedBuilder()
.setColor(client.config.Colors.Yellow)
.setTitle("Notice:")
.setDescription("An admin needs to configure the commercial role in order for this command to be used.");
return interaction.send({ embeds: [embed] });
}
if (!interaction.member.roles.includes(GuildDB.commercialRole)) {
let embed = new EmbedBuilder()
.setColor(client.config.Colors.Yellow)
.setDescription(`**Notice:** You require the <@&${GuildDB.commercialRole}> role`)
return interaction.send({ embeds: [embed] });
}
let invoices = await client.dbo.collection("invoices").findOne({"invoiceDB.userID": args[0].options[2].value}).then(invoices => invoices);
if (!invoices) {
invoices = {
userID: args[0].options[2].value,
guilds: {}
};
invoices.guilds[GuildDB.serverID] = { invoices: [] };
// Register invoiceDB for user
let newInvoice = new Invoice();
newInvoice.createInvoiceDB(args[0].options[2].value, GuildDB.serverID);
newInvoice.save().catch(err => {
if (err) return client.sendInternalError(interaction, err);
});
} else invoices = invoices.invoiceDB;
if (!client.exists(invoices.guilds[GuildDB.serverID])) {
let success = addInvoiceList(invoices.guilds, GuildDB.serverID, args[0].options[2].value, client);
if (!success) return client.sendInternalError(interaction, 'Failed to add invoice list');
}
let ID = Math.floor(100000 + Math.random() * 900000);
let invoice = {
id: ID,
name: args[0].options[0].value,
description: args[0].options[1].value,
amount: args[0].options[3].value,
to: args[0].options[2].value,
from: interaction.member.user.id,
paid: false
};
let success = addInvoice(GuildDB.serverID, args[0].options[2].value, invoice, client);
if (!success) return client.sendInternalError(interaction, 'Failed to add invoice to user');
let successEmbed = new EmbedBuilder()
.setTitle("Success")
.setDescription(`Successfully sent invoice **${ID}** to <@${args[0].options[2].value}>`)
.setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successEmbed] });
}
},
},
}
+3 -3
View File
@@ -96,14 +96,14 @@ module.exports = {
let newBank = new Bank(); let newBank = new Bank();
newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance); newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance);
newBank.save().catch(err => { newBank.save().catch(err => {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else banking = banking.banking; } else banking = banking.banking;
if (!client.exists(banking.guilds[GuildDB.serverID])) { if (!client.exists(banking.guilds[GuildDB.serverID])) {
const success = addBank(banking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance); const success = addBank(banking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance);
if (!success) return client.sendInternalError('Failed to add bank'); if (!success) return client.sendInternalError(interaction, 'Failed to add bank');
} }
const newBalance = args[0].name == 'add' const newBalance = args[0].name == 'add'
@@ -111,7 +111,7 @@ module.exports = {
: banking.guilds[GuildDB.serverID].account.balance - args[0].options[1].value; : banking.guilds[GuildDB.serverID].account.balance - args[0].options[1].value;
client.dbo.collection("banks").updateOne({"banking.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance}}, function(err, res) { client.dbo.collection("banks").updateOne({"banking.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
+2 -2
View File
@@ -71,13 +71,13 @@ module.exports = {
let newInventory = new Inventory(); let newInventory = new Inventory();
newInventory.createInventory(targetUserID, GuildDB.serverID); newInventory.createInventory(targetUserID, GuildDB.serverID);
newInventory.save().catch(err => { newInventory.save().catch(err => {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else inventory = targetUserInventory.inventory; } else inventory = targetUserInventory.inventory;
if (!client.exists(inventory.guilds[GuildDB.serverID])) { if (!client.exists(inventory.guilds[GuildDB.serverID])) {
const success = addInventory(inventory.guilds, GuildDB.serverID, targetUserID, client); const success = addInventory(inventory.guilds, GuildDB.serverID, targetUserID, client);
if (!success) return client.sendInternalError('Failed to add inventory'); if (!success) return client.sendInternalError(interaction, 'Failed to add inventory');
} }
// Display Inventory // Display Inventory
+3 -3
View File
@@ -83,13 +83,13 @@ module.exports = {
let newInventory = new Inventory(); let newInventory = new Inventory();
newInventory.createInventory(interaction.member.user.id, GuildDB.serverID); newInventory.createInventory(interaction.member.user.id, GuildDB.serverID);
newInventory.save().catch(err => { newInventory.save().catch(err => {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else inventory = inventory.inventory } else inventory = inventory.inventory
if (!client.exists(inventory.guilds[GuildDB.serverID])) { if (!client.exists(inventory.guilds[GuildDB.serverID])) {
const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client); const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client);
if (!success) return client.sendInternalError('Failed to add inventory'); if (!success) return client.sendInternalError(interaction, 'Failed to add inventory');
} }
if (args[0].name == "view") { if (args[0].name == "view") {
@@ -140,7 +140,7 @@ module.exports = {
} }
client.dbo.collection("inventories").updateOne(query, update, function (err, res) { client.dbo.collection("inventories").updateOne(query, update, function (err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
let successEmbed = new EmbedBuilder() let successEmbed = new EmbedBuilder()
+6 -6
View File
@@ -50,13 +50,13 @@ module.exports = {
let newInventory = new Inventory(); let newInventory = new Inventory();
newInventory.createInventory(interaction.member.user.id, GuildDB.serverID); newInventory.createInventory(interaction.member.user.id, GuildDB.serverID);
newInventory.save().catch(err => { newInventory.save().catch(err => {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else inventory = inventory.inventory } else inventory = inventory.inventory
if (!client.exists(inventory.guilds[GuildDB.serverID])) { if (!client.exists(inventory.guilds[GuildDB.serverID])) {
const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client); const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client);
if (!success) return client.sendInternalError('Failed to add inventory'); if (!success) return client.sendInternalError(interaction, 'Failed to add inventory');
} }
const now = new Date(); const now = new Date();
@@ -92,14 +92,14 @@ module.exports = {
let newBank = new Bank(); let newBank = new Bank();
newBank.createBank(interaction.member.user.id, GuildDB.serverID, GuildDB.startingBalance); newBank.createBank(interaction.member.user.id, GuildDB.serverID, GuildDB.startingBalance);
newBank.save().catch(err => { newBank.save().catch(err => {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
} else banking = banking.banking; } else banking = banking.banking;
if (!client.exists(banking.guilds[GuildDB.serverID])) { if (!client.exists(banking.guilds[GuildDB.serverID])) {
const success = addBank(banking.guilds, GuildDB.serverID, interaction.member.user.id, client, GuildDB.startingBalance); const success = addBank(banking.guilds, GuildDB.serverID, interaction.member.user.id, client, GuildDB.startingBalance);
if (!success) return client.sendInternalError('Failed to add bank'); if (!success) return client.sendInternalError(interaction, 'Failed to add bank');
} }
let job, earned; let job, earned;
@@ -112,11 +112,11 @@ module.exports = {
newBalance = banking.guilds[GuildDB.serverID].account.balance + earned newBalance = banking.guilds[GuildDB.serverID].account.balance + earned
client.dbo.collection("banks").updateOne({"banking.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance}}, function(err, res) { client.dbo.collection("banks").updateOne({"banking.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id}, {$set: {[`inventory.guilds.${GuildDB.serverID}.lastWork`]: now}}, function(err, res) { client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id}, {$set: {[`inventory.guilds.${GuildDB.serverID}.lastWork`]: now}}, function(err, res) {
if (err) return client.sendInternalError(err); if (err) return client.sendInternalError(interaction, err);
}); });
const success = new EmbedBuilder() const success = new EmbedBuilder()
+1 -1
View File
@@ -2,7 +2,7 @@ require('dotenv').config();
module.exports = { module.exports = {
Dev: "PROD.", Dev: "PROD.",
Version: "12.8.2", // (major).(feature).(revision/bug/refactoring) Version: "12.8.3", // (major).(feature).(revision/bug/refactoring)
Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot
DefaultPrefix: "?", DefaultPrefix: "?",
ServerID: "955668596745461830", ServerID: "955668596745461830",
+1 -1
View File
@@ -12,6 +12,6 @@ module.exports = async (client, interaction) => {
try { try {
interactionHandler.run(client, interaction, { GuildDB }); interactionHandler.run(client, interaction, { GuildDB });
} catch (err) { } catch (err) {
client.sendInternalError(err); client.sendInternalError(interaction, err);
} }
} }
+1 -1
View File
@@ -143,7 +143,7 @@ class QuarksBot extends Client {
this.error(Error); this.error(Error);
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`) .setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.setColor(client.config.Colors.Red) .setColor(this.config.Colors.Red)
Interaction.send({ embeds: [embed] }); Interaction.send({ embeds: [embed] });
} }