forked from Galactic/galactic-bot
cleanup
This commit is contained in:
parent
a3de76c8bd
commit
5839d1c25d
@ -278,6 +278,10 @@ class DiscordClient extends Client {
|
||||
return this.storageManager.mongodb;
|
||||
}
|
||||
|
||||
get moderation() {
|
||||
return this.moderationManager;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// module.exports = DiscordClient;
|
||||
|
@ -419,13 +419,14 @@ class ModerationManager {
|
||||
}
|
||||
|
||||
//TODO: Log this, should never error... hopefully.
|
||||
await this.client.storageManager.mongodb.infractions.updateOne(
|
||||
{ id: i.id },
|
||||
{ _callbacked: true }
|
||||
).catch((e) => {
|
||||
this.logger.error(`Error during update of infraction:\n${e.stack || e}`);
|
||||
});
|
||||
this.callbacks.delete(i.id);
|
||||
// await this.client.storageManager.mongodb.infractions.updateOne(
|
||||
// { id: i.id },
|
||||
// { _callbacked: true }
|
||||
// ).catch((e) => {
|
||||
// this.logger.error(`Error during update of infraction:\n${e.stack || e}`);
|
||||
// });
|
||||
// this.callbacks.delete(i.id);
|
||||
await this.removeCallback(this.callbacks.get(i.id), true);
|
||||
|
||||
return true;
|
||||
|
||||
@ -451,13 +452,15 @@ class ModerationManager {
|
||||
|
||||
}
|
||||
|
||||
async removeCallback(callback) {
|
||||
async removeCallback(callback, updateCase = false) {
|
||||
this.logger.debug(`Removing callback ${callback.infraction.type} for user ${callback.infraction.target}.`);
|
||||
// await this.client.storageManager.mongodb.infractions.updateOne(
|
||||
// { id: expiration.infraction.id },
|
||||
// { _callbacked: true }
|
||||
// ).catch((e) => { }); //eslint-disable-line no-empty, no-unused-vars, no-empty-function
|
||||
clearTimeout(callback.timeout); //just incase node.js is doing some bullshit
|
||||
if(updateCase) await this.client.storageManager.mongodb.infractions.updateOne(
|
||||
{ id: callback.infraction.id },
|
||||
{ _callbacked: true }
|
||||
).catch((e) => {
|
||||
this.logger.error(`Error during update of infraction:\n${e.stack || e}`);
|
||||
});
|
||||
clearTimeout(callback.timeout);
|
||||
this.callbacks.delete(callback.infraction.id);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user