Botban feature #16

Merged
Navy.gif merged 11 commits from development into alpha 2024-09-30 17:50:50 +02:00
3 changed files with 6 additions and 3 deletions
Showing only changes of commit 5ca8dfbfc9 - Show all commits

View File

@ -204,7 +204,7 @@ class ModerationManager implements Initialisable, CallbackClient
const results = await this.#client.mongodb.infractions.find<InfractionJSON>(filter);
this.#logger.info(`Filtering ${results.length} infractions for callback.`);
for (const result of results)
this.handleTimedInfraction(result);
await this.handleTimedInfraction(result);
const ids = results.map(result => result._id);
await this.#client.mongodb.infractions.removeProperty({ _id: { $in: ids } }, [ '_callbacked' ]);
this.#ready = true;
@ -754,7 +754,9 @@ class ModerationManager implements Initialisable, CallbackClient
async findActiveInfraction (type: InfractionType, target: string, guild: string)
{
const [ callback ] = await this.#client.callbacks.queryCallbacks<InfractionJSON>({ type, target, guild }, this);
return callback ?? null;
if (!callback)
return null;
return callback;
}
async findActiveInfractions (query: Partial<InfractionJSON>)

View File

@ -71,7 +71,7 @@ class UtilityHook extends Observer
// });
const callback = await this.client.moderation.findActiveInfraction('MUTE', member.id, guild.id);
const infraction = callback.payload;
const infraction = callback?.payload;
if (!infraction || infraction.resolved)
return;

View File

@ -86,6 +86,7 @@ class Controller extends EventEmitter
// this.#shardingManager.on('message', this._handleMessage.bind(this));
process.on('SIGINT', this.shutdown.bind(this));
process.on('SIGTERM', this.shutdown.bind(this));
}
async build ()