fix/ensure-proper-sendError
This commit is contained in:
34 files changed
+52
-57
No files matched your search
@@ -6,7 +6,7 @@ module.exports = {
|
||||
|
||||
let guild = await client.GetGuild(guildId);
|
||||
if (!client.exists(guild.connectionLogsChannel)) return;
|
||||
const channel = client.channels.cache.get(guild.connectionLogsChannel);
|
||||
const channel = client.GetChannel(guild.connectionLogsChannel);
|
||||
|
||||
let newDt = await client.getDateEST(data.time);
|
||||
let unixTime = Math.floor(newDt.getTime()/1000);
|
||||
@@ -40,7 +40,7 @@ module.exports = {
|
||||
|
||||
let guild = await client.GetGuild(guildId);
|
||||
if (!client.exists(guild.connectionLogsChannel)) return;
|
||||
const channel = client.channels.cache.get(guild.connectionLogsChannel);
|
||||
const channel = client.GetChannel(guild.connectionLogsChannel);
|
||||
if (!channel) return;
|
||||
|
||||
let unixTime = Math.floor(newDt.getTime()/1000);
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = {
|
||||
let distance = Math.sqrt(Math.pow(diff[0], 2) + Math.pow(diff[1], 2)).toFixed(2)
|
||||
|
||||
if (distance < alarm.radius) {
|
||||
const channel = client.channels.cache.get(alarm.channel);
|
||||
const channel = client.GetChannel(alarm.channel);
|
||||
|
||||
let newDt = await client.getDateEST(data.time);
|
||||
let unixTime = Math.floor(newDt.getTime()/1000);
|
||||
@@ -90,7 +90,7 @@ module.exports = {
|
||||
|
||||
if (update) {
|
||||
client.dbo.collection("guilds").updateOne({ "server.serverID": guildId }, {$set: { "server.uavs": uavs }}, function (err, res) {
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
if (err) return client.sendError(client.GetChannel(guild.adminLogsChannel), err);
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -108,7 +108,7 @@ module.exports = {
|
||||
let distance = Math.sqrt(Math.pow(diff[0], 2) + Math.pow(diff[1], 2)).toFixed(2)
|
||||
|
||||
if (distance < alarm.radius) {
|
||||
const channel = client.channels.cache.get(alarm.channel);
|
||||
const channel = client.GetChannel(alarm.channel);
|
||||
|
||||
let newDt = await client.getDateEST(data.time);
|
||||
let unixTime = Math.floor(newDt.getTime()/1000);
|
||||
@@ -127,7 +127,7 @@ module.exports = {
|
||||
|
||||
ExpireEvent: async(client, guild, e) => {
|
||||
let hasMR = (guild.memberRole != "");
|
||||
const channel = client.channels.cache.get(e.channel);
|
||||
const channel = client.GetChannel(e.channel);
|
||||
if (client.exists(e.channel)) channel.send({ embeds: [new EmbedBuilder().setColor(client.config.colors.Default).setDescription(`${hasMR ? `<@&${guild.memberRole}>\n`:''}**The ${e.name} Event has ended!**`)] });
|
||||
|
||||
client.dbo.collection("guilds").updateOne({ "server.serverID": guild.serverID }, {
|
||||
@@ -135,7 +135,7 @@ module.exports = {
|
||||
"server.events": e
|
||||
}
|
||||
}, function(err, res) {
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
if (err) return client.sendError(client.GetChannel(guild.adminLogsChannel), err);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -152,7 +152,7 @@ module.exports = {
|
||||
.setDescription(`**${e.name} Event**\n${e.gamertag} was located at **[${player.pos[0]}, ${player.pos[1]}](https://www.izurvive.com/chernarusplussatmap/#location=${player.pos[0]};${player.pos[1]})** at <t:${unixTime}>`);
|
||||
|
||||
if (!client.exists(e.channel)) return module.exports.ExpireEvent(client, guild, e); // Expire event since it has invalid channel.
|
||||
const channel = client.channels.cache.get(e.channel);
|
||||
const channel = client.GetChannel(e.channel);
|
||||
channel.send({ embeds: [trackEvent], content: `${hasMR ? `\n<@&${guild.memberRole}>`:'@here'}` });
|
||||
|
||||
let now = new Date();
|
||||
|
||||
@@ -7,7 +7,7 @@ module.exports = {
|
||||
HandleKillfeed: async (client, guildId, stats, line) => {
|
||||
|
||||
let guild = await client.GetGuild(guildId);
|
||||
const channel = client.channels.cache.get(guild.killfeedChannel);
|
||||
const channel = client.GetChannel(guild.killfeedChannel);
|
||||
|
||||
let templateKilled = /(.*) \| Player \"(.*)\" \(DEAD\) \(id=(.*) pos=<(.*)>\) killed by Player \"(.*)\" \(id=(.*) pos=<(.*)>\) with (.*) from (.*) meters /g;
|
||||
let template = /(.*) \| Player \"(.*)\" \(id=(.*) pos=<(.*)>\)\[HP\: (.*)\] hit by Player \"(.*)\" \(id=(.*) pos=<(.*)>\) into (.*) for (.*) damage \((.*)\) with (.*) from (.*) meters /g;
|
||||
@@ -115,14 +115,14 @@ module.exports = {
|
||||
let newBank = new User();
|
||||
newBank.createUser(killerStat.discordID, guildId, guild.startingBalance);
|
||||
newBank.save().catch(err => {
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
if (err) return client.sendError(client.GetChannel(guild.killfeedChannel), err);
|
||||
});
|
||||
|
||||
} else banking = banking.user;
|
||||
|
||||
if (!client.exists(banking.guilds[guildId])) {
|
||||
const success = addUser(banking.guilds, guildId, killer.discordID, this, guild.startingBalance);
|
||||
if (!success) return client.sendError(guild.connectionLogsChannel, 'Failed to add bank');
|
||||
if (!success) return client.sendError(client.GetChannel(guild.killfeedChannel), 'Automatic Bounty Payout: Failed to add bank to database.');
|
||||
}
|
||||
|
||||
const newBalance = banking.guilds[guildId].balance + totalBounty;
|
||||
@@ -132,7 +132,7 @@ module.exports = {
|
||||
[`user.guilds.${guildId}.balance`]: newBalance,
|
||||
}
|
||||
}, function(err, res) {
|
||||
if (err) return client.sendError(guild.connectionLogsChannel, err);
|
||||
if (err) return client.sendError(client.GetChannel(guild.killfeedChannel), `Killfeed Error: Updating killer bank balance\n${err}`);
|
||||
});
|
||||
|
||||
receivedBounty = new EmbedBuilder()
|
||||
|
||||
+2
-2
@@ -197,7 +197,7 @@ module.exports = {
|
||||
if (!client.exists(guild.playerstats)) guild.playerstats = [];
|
||||
if (!client.exists(guild.activePlayersChannel)) return;
|
||||
|
||||
const channel = client.channels.cache.get(guild.activePlayersChannel);
|
||||
const channel = client.GetChannel(guild.activePlayersChannel);
|
||||
let activePlayers = guild.playerstats.filter(p => p.connected == true);
|
||||
|
||||
let des = ``;
|
||||
@@ -223,7 +223,7 @@ module.exports = {
|
||||
|
||||
return channel.send({ embeds: [PlayersEmbed, activePlayersEmbed] }).then(sentMessage => {
|
||||
setTimeout(() => {
|
||||
sentMessage.delete().catch(error => client.sendError(channel, error));
|
||||
sentMessage.delete().catch(error => client.sendError(channel, `HandleActivePlayersList Error: \n${error}`));
|
||||
}, 360000);
|
||||
});
|
||||
}
|
||||
|
||||
+1
-4
@@ -39,10 +39,7 @@ module.exports = {
|
||||
let bans = res.data.gameserver.settings.general.bans;
|
||||
if (ban) bans += `\r\n${gamertag}`;
|
||||
else if (!ban) bans = bans.replace(gamertag, '');
|
||||
else {
|
||||
client.error("Incorrect Ban Option: HandlePlayerBan")
|
||||
throw "Incorrect Ban Option: HandlePlayerBan"
|
||||
}
|
||||
else client.error("Incorrect Ban Option: HandlePlayerBan");
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("category", "general");
|
||||
|
||||
@@ -5,7 +5,7 @@ const { REST } = require('@discordjs/rest');
|
||||
|
||||
/**
|
||||
* Register slash commands for a guild
|
||||
* @param {require("../structures/QuarksBot")} client
|
||||
* @param {require("../structures/DayzRBot")} client
|
||||
*/
|
||||
module.exports = {
|
||||
// Register guild commands
|
||||
|
||||
Reference in new issue
Block a user