fix/ensure-proper-sendError

This commit is contained in:
SowinskiBraeden committed 2023-09-02 19:25:17 -07:00
1 parent 1bc10658dc
commit 40ffeab665
34 files changed
+52 -57

No files matched your search

+5 -4
View File
@@ -100,7 +100,6 @@ class DayzRBot extends Client {
const client = this;
}
log(Text) { this.logger.log(Text); }
error(Text) { this.logger.error(Text); }
@@ -186,7 +185,7 @@ class DayzRBot extends Client {
"server.playerstats": s
}
}, function (err, res) {
if (err) this.error(err);
if (err) this.sendError(this.GetChannel(guild.adminLogsChannel), err);
});
history.lastLog = lines[lines.length-1];
@@ -306,11 +305,14 @@ class DayzRBot extends Client {
const event = require(EventsDir + "/" + file);
if (['interactionCreate','guildMemberAdd'].includes(file.split(".")[0])) this.on(file.split(".")[0], i => event(this, i));
else this.on(file.split(".")[0], event.bind(null, this));
this.logger.log("Event Loaded: " + file.split(".")[0]);
this.log("Event Loaded: " + file.split(".")[0]);
});
});
}
// Allows shorter lines of code elsewhere
GetChannel(channel_id) { return this.channels.cache.get(channel_id); }
sendError(Channel, Error) {
this.error(Error);
let embed = new EmbedBuilder()
@@ -320,7 +322,6 @@ class DayzRBot extends Client {
Channel.send(embed);
}
// Handles internal errors for slash commands. E.g failed to update database from slash command.
sendInternalError(Interaction, Error) {
this.error(Error);