Update alpha branch #13

Merged
Navy.gif merged 6 commits from development into alpha 2024-07-26 16:34:13 +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); const results = await this.#client.mongodb.infractions.find<InfractionJSON>(filter);
this.#logger.info(`Filtering ${results.length} infractions for callback.`); this.#logger.info(`Filtering ${results.length} infractions for callback.`);
for (const result of results) for (const result of results)
this.handleTimedInfraction(result); await this.handleTimedInfraction(result);
const ids = results.map(result => result._id); const ids = results.map(result => result._id);
await this.#client.mongodb.infractions.removeProperty({ _id: { $in: ids } }, [ '_callbacked' ]); await this.#client.mongodb.infractions.removeProperty({ _id: { $in: ids } }, [ '_callbacked' ]);
this.#ready = true; this.#ready = true;
@ -754,7 +754,9 @@ class ModerationManager implements Initialisable, CallbackClient
async findActiveInfraction (type: InfractionType, target: string, guild: string) async findActiveInfraction (type: InfractionType, target: string, guild: string)
{ {
const [ callback ] = await this.#client.callbacks.queryCallbacks<InfractionJSON>({ type, target, guild }, this); 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>) 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 callback = await this.client.moderation.findActiveInfraction('MUTE', member.id, guild.id);
const infraction = callback.payload; const infraction = callback?.payload;
if (!infraction || infraction.resolved) if (!infraction || infraction.resolved)
return; return;

View File

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