debugging

This commit is contained in:
SowinskiBraeden committed 2022-08-03 18:32:52 -07:00
1 parent 83bb4edd7d
commit a1f6a8e531
3 files changed
+26 -25

No files matched your search

+5 -4
View File
@@ -1,6 +1,6 @@
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const action = ['pick up', 'grab', 'get', 'aquire', 'obtain', 'gain', 'take possesssion of']; const actions = ['pick up', 'grab', 'get', 'aquire', 'obtain', 'gain', 'take possesssion of'];
module.exports = { module.exports = {
name: "inventory-add", name: "inventory-add",
@@ -130,7 +130,8 @@ module.exports = {
type: 'firearm', type: 'firearm',
weaponType: args[0].options[0].value, weaponType: args[0].options[0].value,
serial: args[0].options[1].value, serial: args[0].options[1].value,
ownerName: args[0].options[2].value ownerName: args[0].options[2].value,
description: args[0].options[3].value
} }
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$push: {'inventory.items': firearm}}, function(err, res) { client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$push: {'inventory.items': firearm}}, function(err, res) {
@@ -145,7 +146,7 @@ module.exports = {
}); });
let message = new MessageEmbed() let message = new MessageEmbed()
.setTitle(`You ${action[Math.floor(Math.random() * actions.length)]} a ${firearm.weaponType}`) .setTitle(`You ${actions[Math.floor(Math.random() * actions.length)]} a ${firearm.weaponType}`)
.setColor(client.config.EmbedColor); .setColor(client.config.EmbedColor);
return interaction.send({ embeds: [message] }); return interaction.send({ embeds: [message] });
@@ -171,7 +172,7 @@ module.exports = {
}); });
let message = new MessageEmbed() let message = new MessageEmbed()
.setTitle(`You ${action[Math.floor(Math.random() * actions.length)]} a ${item.name}`) .setTitle(`You ${actions[Math.floor(Math.random() * actions.length)]} a ${item.name}`)
.setColor(client.config.EmbedColor); .setColor(client.config.EmbedColor);
return interaction.send({ embeds: [message] }); return interaction.send({ embeds: [message] });
+19 -19
View File
@@ -122,10 +122,10 @@ module.exports = {
.catch(err => { .catch(err => {
if (err) { if (err) {
client.log(err); client.log(err);
let embed = new MessageEmbed() const embed = new MessageEmbed()
.setTitle(err) .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.setColor("RED") .setColor("RED")
return interaction.send({ embeds: [embed] }); return interaction.send({ embeds: [embed] });
} }
}); });
@@ -192,9 +192,10 @@ module.exports = {
itemEmbed.setTitle('Firearm'); itemEmbed.setTitle('Firearm');
itemEmbed.addFields( itemEmbed.addFields(
{ name: 'Serial #', value: item.serial, inline: false }, { name: 'Serial #', value: item.serial, inline: true },
{ name: 'Type', value: item.weaponType, inline: false }, { name: 'Type', value: item.weaponType, inline: true },
{ name: 'Owner', value: item.ownerName, inline: false } { name: 'Description', value: item.description, inline: true },
{ name: 'Owner', value: item.ownerName, inline: true }
); );
} else { } else {
@@ -230,10 +231,10 @@ module.exports = {
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {'inventory.items': item}}, function(err, res) { client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {'inventory.items': item}}, function(err, res) {
if (err) { if (err) {
client.log(err); client.log(err);
let embed = new MessageEmbed() const embed = new MessageEmbed()
.setTitle(err) .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.setColor("RED") .setColor("RED")
return interaction.send({ embeds: [embed] }); return interaction.send({ embeds: [embed] });
} }
@@ -275,32 +276,31 @@ module.exports = {
.catch(err => { .catch(err => {
if (err) { if (err) {
client.log(err); client.log(err);
let embed = new MessageEmbed() const embed = new MessageEmbed()
.setTitle(err) .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.setColor("RED") .setColor("RED")
return interaction.send({ embeds: [embed] }); return interaction.send({ embeds: [embed] });
} }
}); });
} else { } else {
targetUserInventory = targetUserInventory.inventory;
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {'inventory.items': item}}, function(err, res) { client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {'inventory.items': item}}, function(err, res) {
if (err) { if (err) {
client.log(err); client.log(err);
let embed = new MessageEmbed() const embed = new MessageEmbed()
.setTitle(err) .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.setColor("RED") .setColor("RED")
return interaction.send({ embeds: [embed] }); return interaction.send({ embeds: [embed] });
} }
}); });
client.dbo.collection('inventories').updateOne({'inventory.userID': targetUserID}, {$push: {'inventory.items': item}}, function(err, res) { client.dbo.collection('inventories').updateOne({'inventory.userID': targetUserID}, {$push: {'inventory.items': item}}, function(err, res) {
if (err) { if (err) {
client.log(err); client.log(err);
let embed = new MessageEmbed() const embed = new MessageEmbed()
.setTitle(err) .setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.setColor("RED") .setColor("RED")
return interaction.send({ embeds: [embed] }); return interaction.send({ embeds: [embed] });
} }
}); });
+2 -2
View File
@@ -109,7 +109,7 @@ module.exports = {
} }
let successEmbed = new MessageEmbed() let successEmbed = new MessageEmbed()
.setDescription(`Successfully added $${args[1].value.toFixed(2)} to <@${targetUserID}>'s balance`) .setDescription(`Successfully added $${args[0].options[1].value.toFixed(2)} to <@${targetUserID}>'s balance`)
.setColor('GREEN'); .setColor('GREEN');
return interaction.send({ embeds: [successEmbed] }); return interaction.send({ embeds: [successEmbed] });
@@ -154,7 +154,7 @@ module.exports = {
} }
let successEmbed = new MessageEmbed() let successEmbed = new MessageEmbed()
.setDescription(`Successfully removed $${args[1].value.toFixed(2)} from <@${targetUserID}>'s balance`) .setDescription(`Successfully removed $${args[0].options[1].value.toFixed(2)} from <@${targetUserID}>'s balance`)
.setColor('GREEN'); .setColor('GREEN');
return interaction.send({ embeds: [successEmbed] }); return interaction.send({ embeds: [successEmbed] });