change/simplify err function handles

This commit is contained in:
SowinskiBraeden authored and GitHub committed 2023-09-04 10:52:16 -07:00
1 parent cbdbd18051
commit 317c48de36
19 files changed
+61 -61

No files matched your search

+4 -4
View File
@@ -168,7 +168,7 @@ module.exports = {
$set: { $set: {
"server.playerstats": [] "server.playerstats": []
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
} }
@@ -232,7 +232,7 @@ module.exports = {
$set: { $set: {
"server.playerstats": [] "server.playerstats": []
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
} }
@@ -333,7 +333,7 @@ module.exports = {
$set: { $set: {
'server.playerstats': GuildDB.playerstats, 'server.playerstats': GuildDB.playerstats,
} }
}, function(err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -396,7 +396,7 @@ module.exports = {
? banking.guilds[GuildDB.serverID].balance + args[0].options[0].value ? banking.guilds[GuildDB.serverID].balance + args[0].options[0].value
: banking.guilds[GuildDB.serverID].balance - args[0].options[0].value; : banking.guilds[GuildDB.serverID].balance - args[0].options[0].value;
client.dbo.collection("users").updateOne({"user.userID":targetUserID},{$set:{[`user.guilds.${GuildDB.serverID}.balance`]:newBalance}}, function(err, res) { client.dbo.collection("users").updateOne({"user.userID":targetUserID},{$set:{[`user.guilds.${GuildDB.serverID}.balance`]:newBalance}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
+8 -8
View File
@@ -220,7 +220,7 @@ module.exports = {
$push: { $push: {
'server.alarms': alarm, 'server.alarms': alarm,
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -406,7 +406,7 @@ module.exports = {
$pull: { $pull: {
'server.alarms': alarm, 'server.alarms': alarm,
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -452,7 +452,7 @@ module.exports = {
$set: { $set: {
'server.alarms': GuildDB.alarms, 'server.alarms': GuildDB.alarms,
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -484,7 +484,7 @@ module.exports = {
$set: { $set: {
'server.alarms': GuildDB.alarms, 'server.alarms': GuildDB.alarms,
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -536,7 +536,7 @@ module.exports = {
$set: { $set: {
'server.alarms': GuildDB.alarms, 'server.alarms': GuildDB.alarms,
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -566,7 +566,7 @@ module.exports = {
$set: { $set: {
'server.alarms': GuildDB.alarms, 'server.alarms': GuildDB.alarms,
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -597,7 +597,7 @@ module.exports = {
$set: { $set: {
'server.alarms': GuildDB.alarms, 'server.alarms': GuildDB.alarms,
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -628,7 +628,7 @@ module.exports = {
$set: { $set: {
'server.alarms': GuildDB.alarms, 'server.alarms': GuildDB.alarms,
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
+2 -2
View File
@@ -155,7 +155,7 @@ module.exports = {
const newBalance = banking.guilds[GuildDB.serverID].balance - args[0].options[1].value; const newBalance = banking.guilds[GuildDB.serverID].balance - args[0].options[1].value;
client.dbo.collection("users").updateOne({"user.userID":interaction.member.user.id},{$set:{[`user.guilds.${GuildDB.serverID}.balance`]:newBalance}}, function(err, res) { client.dbo.collection("users").updateOne({"user.userID":interaction.member.user.id},{$set:{[`user.guilds.${GuildDB.serverID}.balance`]:newBalance}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -181,7 +181,7 @@ module.exports = {
const newTargetBalance = targetUserBanking.guilds[GuildDB.serverID].balance + args[0].options[1].value; const newTargetBalance = targetUserBanking.guilds[GuildDB.serverID].balance + args[0].options[1].value;
client.dbo.collection("users").updateOne({"user.userID":targetUserID},{$set:{[`user.guilds.${GuildDB.serverID}.balance`]:newTargetBalance}}, function(err, res) { client.dbo.collection("users").updateOne({"user.userID":targetUserID},{$set:{[`user.guilds.${GuildDB.serverID}.balance`]:newTargetBalance}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
+4 -4
View File
@@ -104,7 +104,7 @@ module.exports = {
$set: { $set: {
[`user.guilds.${GuildDB.serverID}.balance`]: newBalance, [`user.guilds.${GuildDB.serverID}.balance`]: newBalance,
} }
}, function(err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -121,7 +121,7 @@ module.exports = {
$set: { $set: {
'server.playerstats': GuildDB.playerstats, 'server.playerstats': GuildDB.playerstats,
} }
}, function(err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -162,7 +162,7 @@ module.exports = {
const newBalance = banking.guilds[GuildDB.serverID].balance - (totalBounty * 2); const newBalance = banking.guilds[GuildDB.serverID].balance - (totalBounty * 2);
client.dbo.collection("users").updateOne({"user.userID":interaction.member.user.id},{$set:{[`user.guilds.${GuildDB.serverID}.balance`]:newBalance}}, function(err, res) { client.dbo.collection("users").updateOne({"user.userID":interaction.member.user.id},{$set:{[`user.guilds.${GuildDB.serverID}.balance`]:newBalance}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -173,7 +173,7 @@ module.exports = {
$set: { $set: {
'server.playerstats': GuildDB.playerstats, 'server.playerstats': GuildDB.playerstats,
} }
}, function(err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
+2 -2
View File
@@ -129,12 +129,12 @@ module.exports = {
for (const [fid, data] of Object.entries(GuildDB.factionArmbands)) { for (const [fid, data] of Object.entries(GuildDB.factionArmbands)) {
if (fid == factionID) removeQuery = data.armband; if (fid == factionID) removeQuery = data.armband;
} }
client.dbo.collection("guilds").updateOne({'server.serverID': GuildDB.serverID}, {$pull: {'server.usedArmbands': removeQuery}}, function (err, res) { client.dbo.collection("guilds").updateOne({'server.serverID': GuildDB.serverID}, {$pull: {'server.usedArmbands': removeQuery}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}) })
} }
client.dbo.collection("guilds").updateOne({'server.serverID': GuildDB.serverID}, query, function (err, res) { client.dbo.collection("guilds").updateOne({'server.serverID': GuildDB.serverID}, query, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}) })
+1 -1
View File
@@ -89,7 +89,7 @@ module.exports = {
newData.balance += totalIncome; newData.balance += totalIncome;
newData.lastIncome = now; newData.lastIncome = now;
client.dbo.collection("users").updateOne({"user.userID":interaction.member.user.id},{$set:{[`user.guilds.${GuildDB.serverID}`]: newData}}, function(err, res) { client.dbo.collection("users").updateOne({"user.userID":interaction.member.user.id},{$set:{[`user.guilds.${GuildDB.serverID}`]: newData}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
+22 -22
View File
@@ -349,7 +349,7 @@ module.exports = {
if (channelAdd.type=="voice") {error=true;newChannelErrorEmbed.setDescription(`**Error Notice:** Cannot add voice channel to allowed channels.`);} if (channelAdd.type=="voice") {error=true;newChannelErrorEmbed.setDescription(`**Error Notice:** Cannot add voice channel to allowed channels.`);}
if (error) return interaction.send({ embeds: [newChannelErrorEmbed] }); if (error) return interaction.send({ embeds: [newChannelErrorEmbed] });
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}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -390,7 +390,7 @@ module.exports = {
if (args[0].options[0].value == 'add') { if (args[0].options[0].value == 'add') {
const botAdminRoleId = args[0].options[1].value; const botAdminRoleId = args[0].options[1].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$push: {"server.botAdminRoles": botAdminRoleId}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$push: {"server.botAdminRoles": botAdminRoleId}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -430,7 +430,7 @@ module.exports = {
} }
case 'admin_role': case 'admin_role':
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.adminRole": args[0].options[0].value}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.adminRole": args[0].options[0].value}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -442,7 +442,7 @@ module.exports = {
case 'exclude': case 'exclude':
if (args[0].options[0].value == 'add') { if (args[0].options[0].value == 'add') {
client.dbo.collection('guilds').updateOne({'server.serverID': GuildDB.serverID}, {$push: {'server.excludedRoles': args[0].options[1].value}}, function(err, res) { client.dbo.collection('guilds').updateOne({'server.serverID': GuildDB.serverID}, {$push: {'server.excludedRoles': args[0].options[1].value}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}) })
@@ -453,7 +453,7 @@ module.exports = {
return interaction.send({ embeds: [successExcludeEmbed] }); return interaction.send({ embeds: [successExcludeEmbed] });
} else if (args[0].options[0].value == 'remove') { } else if (args[0].options[0].value == 'remove') {
client.dbo.collection('guilds').updateOne({'server.serverID': GuildDB.serverID}, {$pull: {'server.excludedRoles': args[0].options[1].value}}, function(err, res) { client.dbo.collection('guilds').updateOne({'server.serverID': GuildDB.serverID}, {$pull: {'server.excludedRoles': args[0].options[1].value}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}) })
@@ -510,7 +510,7 @@ module.exports = {
case 'killfeed_channel': case 'killfeed_channel':
const killfeedChannel = args[0].options[0].value; const killfeedChannel = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.killfeedChannel": killfeedChannel}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.killfeedChannel": killfeedChannel}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -523,7 +523,7 @@ module.exports = {
case 'show_killfeed_coords': case 'show_killfeed_coords':
const showKillfeedCoordsConfiguration = args[0].options[0].value; const showKillfeedCoordsConfiguration = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.showKillfeedCoords": showKillfeedCoordsConfiguration}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.showKillfeedCoords": showKillfeedCoordsConfiguration}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -536,7 +536,7 @@ module.exports = {
case 'admin_logs_channel': case 'admin_logs_channel':
const adminLogsChannel = args[0].options[0].value; const adminLogsChannel = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.connectionLogsChannel": adminLogsChannel}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.connectionLogsChannel": adminLogsChannel}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -549,7 +549,7 @@ module.exports = {
case 'welcome_channel': case 'welcome_channel':
const welcomeChannel = args[0].options[0].value; const welcomeChannel = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.welcomeChannel": welcomeChannel}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.welcomeChannel": welcomeChannel}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -562,7 +562,7 @@ module.exports = {
case 'active_players_channel': case 'active_players_channel':
const acticePlayersChannel = args[0].options[0].value; const acticePlayersChannel = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.activePlayersChannel": acticePlayersChannel}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.activePlayersChannel": acticePlayersChannel}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -575,7 +575,7 @@ module.exports = {
case 'linked_gt_role': case 'linked_gt_role':
const linked_gt_role = args[0].options[0].value; const linked_gt_role = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.linkedGamertagRole": linked_gt_role}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.linkedGamertagRole": linked_gt_role}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -588,7 +588,7 @@ module.exports = {
case 'member_role': case 'member_role':
const member_role = args[0].options[0].value; const member_role = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.memberRole": member_role}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.memberRole": member_role}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -599,7 +599,7 @@ module.exports = {
return interaction.send({ embeds: [successMemberRoleEmbed] }); return interaction.send({ embeds: [successMemberRoleEmbed] });
case 'starting_balance': case '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}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -628,7 +628,7 @@ module.exports = {
income: args[0].options[0].options[1].value, income: args[0].options[0].options[1].value,
} }
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}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
} else { } else {
@@ -640,7 +640,7 @@ module.exports = {
$set: { $set: {
"server.incomeRoles.$.income": args[0].options[0].options[1].value "server.incomeRoles.$.income": args[0].options[0].options[1].value
} }
}, function(err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
} }
@@ -682,7 +682,7 @@ module.exports = {
} }
case 'income_limiter': case 'income_limiter':
client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {$set: {"server.incomeLimiter":args[0].options[0].value}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {$set: {"server.incomeLimiter":args[0].options[0].value}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -693,7 +693,7 @@ module.exports = {
return interaction.send({ embeds: [successIncomeLimiterEmbed] }); return interaction.send({ embeds: [successIncomeLimiterEmbed] });
case 'uav-price': case 'uav-price':
client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {$set: {"server.uavPrice":args[0].options[0].value}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {$set: {"server.uavPrice":args[0].options[0].value}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -704,7 +704,7 @@ module.exports = {
return interaction.send({ embeds: [successUAVPriceEmbed] }); return interaction.send({ embeds: [successUAVPriceEmbed] });
case 'emp-price': case 'emp-price':
client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {$set: {"server.empPrice":args[0].options[0].value}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {$set: {"server.empPrice":args[0].options[0].value}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -733,7 +733,7 @@ module.exports = {
let action = '' let action = ''
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}}, (err, res) => {
if (err) return client.sendInternalError(interaction, 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';
@@ -758,7 +758,7 @@ module.exports = {
let roleId = interaction.customId.split('-')[2]; let roleId = interaction.customId.split('-')[2];
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.botAdminRoles": roleId}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull: {"server.botAdminRoles": roleId}}, (err, res) => {
if (err) return client.sendInternalError(interaction, 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';
@@ -784,7 +784,7 @@ module.exports = {
if (interaction.customId.split('-')[1]=='yes') { if (interaction.customId.split('-')[1]=='yes') {
action = 'removed'; action = 'removed';
let income = GuildDB.incemeRoles.find((i) => i.role == roleId); let income = GuildDB.incemeRoles.find((i) => i.role == roleId);
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull: {"server.incomeRoles": income}}, function(err, res) { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull: {"server.incomeRoles": income}}, (err, res) => {
if (err) return client.sendInternalError(interaction, 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';
@@ -809,7 +809,7 @@ module.exports = {
if (interaction.customId.split('-')[1]=='yes') { if (interaction.customId.split('-')[1]=='yes') {
action = 'reset'; action = 'reset';
const defaultGuildConfig = client.getDefaultSettings(GuildDB.serverID); const defaultGuildConfig = client.getDefaultSettings(GuildDB.serverID);
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}}, (err, res) => {
if (err) return client.sendInternalError(interaction, 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';
+2 -2
View File
@@ -93,7 +93,7 @@ module.exports = {
$set: { $set: {
"server.events": events "server.events": events
} }
}, function(err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -138,7 +138,7 @@ module.exports = {
$pull: { $pull: {
'server.events': event, 'server.events': event,
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
+1 -1
View File
@@ -33,7 +33,7 @@ module.exports = {
$set: { $set: {
"server.playerstats": [] "server.playerstats": []
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
} }
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = {
$set: { $set: {
"server.playerstats": [] "server.playerstats": []
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
} }
+1 -1
View File
@@ -27,7 +27,7 @@ module.exports = {
$set: { $set: {
"server.playerstats": [] "server.playerstats": []
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
} }
+1 -1
View File
@@ -51,7 +51,7 @@ module.exports = {
$set: { $set: {
"server.playerstats": [] "server.playerstats": []
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
} }
+2 -2
View File
@@ -63,7 +63,7 @@ module.exports = {
if (GuildDB.alarms.length == 0) return interaction.send({ embeds: [new EmbedBuilder().setColor(client.config.Colors.Default).setDescription('**Notice:** No Existing Alarms to EMP.')], flags: (1 << 6) }); if (GuildDB.alarms.length == 0) return interaction.send({ embeds: [new EmbedBuilder().setColor(client.config.Colors.Default).setDescription('**Notice:** No Existing Alarms to EMP.')], flags: (1 << 6) });
client.dbo.collection("users").updateOne({"user.userID":interaction.member.user.id},{$set:{[`user.guilds.${GuildDB.serverID}.balance`]:newBalance}}, function(err, res) { client.dbo.collection("users").updateOne({"user.userID":interaction.member.user.id},{$set:{[`user.guilds.${GuildDB.serverID}.balance`]:newBalance}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -102,7 +102,7 @@ module.exports = {
$set: { $set: {
'server.alarms': alarms, 'server.alarms': alarms,
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
+2 -2
View File
@@ -78,7 +78,7 @@ module.exports = {
const newBalance = banking.guilds[GuildDB.serverID].balance - GuildDB.uavPrice; const newBalance = banking.guilds[GuildDB.serverID].balance - GuildDB.uavPrice;
client.dbo.collection("users").updateOne({"user.userID":interaction.member.user.id},{$set:{[`user.guilds.${GuildDB.serverID}.balance`]:newBalance}}, function(err, res) { client.dbo.collection("users").updateOne({"user.userID":interaction.member.user.id},{$set:{[`user.guilds.${GuildDB.serverID}.balance`]:newBalance}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
@@ -93,7 +93,7 @@ module.exports = {
$push: { $push: {
'server.uavs': uav, 'server.uavs': uav,
} }
}, function (err, res) { }, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dayzr-bot", "name": "dayzr-bot",
"version": "9.6.0", "version": "9.6.1",
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.", "description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
"main": "index.js", "main": "index.js",
"nodemonConfig": { "nodemonConfig": {
+3 -3
View File
@@ -56,7 +56,7 @@ class DayzRBot extends Client {
$pull: { 'server.usedArmbands': data.armband }, $pull: { 'server.usedArmbands': data.armband },
$unset: { [`server.factionArmbands.${factionID}`]: "" }, $unset: { [`server.factionArmbands.${factionID}`]: "" },
}; };
await this.dbo.collection("guilds").updateOne({'server.serverID': GuildDB.serverID}, query, function (err, res) { await this.dbo.collection("guilds").updateOne({'server.serverID': GuildDB.serverID}, query, (err, res) => {
if (err) return this.sendInternalError(interaction, err); if (err) return this.sendInternalError(interaction, err);
}); });
} }
@@ -185,7 +185,7 @@ class DayzRBot extends Client {
$set: { $set: {
"server.playerstats": s "server.playerstats": s
} }
}, function (err, res) { }, (err, res) => {
if (err) this.sendError(this.GetChannel(guild.adminLogsChannel), err); if (err) this.sendError(this.GetChannel(guild.adminLogsChannel), err);
}); });
@@ -409,7 +409,7 @@ class DayzRBot extends Client {
guild = {} guild = {}
guild.server = this.getDefaultSettings(GuildId); guild.server = this.getDefaultSettings(GuildId);
if (this.databaseConnected) { if (this.databaseConnected) {
this.dbo.collection("guilds").insertOne(guild, function(err, res) { this.dbo.collection("guilds").insertOne(guild, (err, res) => {
if (err) throw err; if (err) throw err;
}); });
} }
+1 -1
View File
@@ -29,7 +29,7 @@ function addUser(guilds, guildID, userID, client, startingBalance) {
lastIncome: new Date('2000-01-01T00:00:00') lastIncome: new Date('2000-01-01T00:00:00')
} }
client.dbo.collection("users").updateOne({"user.userID":userID}, {$set: {"user.guilds": updatedGuilds}}, function(err, res) { client.dbo.collection("users").updateOne({"user.userID":userID}, {$set: {"user.guilds": updatedGuilds}}, (err, res) => {
if (err) return false if (err) return false
}) })
return true return true
+2 -2
View File
@@ -12,7 +12,7 @@ const ExpireEvent = async(client, guild, e) => {
$pull: { $pull: {
"server.events": e "server.events": e
} }
}, function(err, res) { }, (err, res) => {
if (err) return client.sendError(client.GetChannel(guild.adminLogsChannel), err); if (err) return client.sendError(client.GetChannel(guild.adminLogsChannel), err);
}); });
} }
@@ -128,7 +128,7 @@ module.exports = {
} }
if (update) { if (update) {
client.dbo.collection("guilds").updateOne({ "server.serverID": guildId }, {$set: { "server.uavs": uavs }}, function (err, res) { client.dbo.collection("guilds").updateOne({ "server.serverID": guildId }, {$set: { "server.uavs": uavs }}, (err, res) => {
if (err) return client.sendError(client.GetChannel(guild.adminLogsChannel), err); if (err) return client.sendError(client.GetChannel(guild.adminLogsChannel), err);
}); });
} }
+1 -1
View File
@@ -152,7 +152,7 @@ module.exports = {
$set: { $set: {
[`user.guilds.${guildId}.balance`]: newBalance, [`user.guilds.${guildId}.balance`]: newBalance,
} }
}, function(err, res) { }, (err, res) => {
if (err) return client.sendError(client.GetChannel(guild.killfeedChannel), `Killfeed Error: Updating killer bank balance\n${err}`); if (err) return client.sendError(client.GetChannel(guild.killfeedChannel), `Killfeed Error: Updating killer bank balance\n${err}`);
}); });