3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-18 15:45:03 +00:00

User resolving optimizations + debug logging

This commit is contained in:
Dragory 2019-05-02 18:14:36 +03:00
parent 2fe52ab342
commit f8b2c71fef
5 changed files with 38 additions and 8 deletions

View file

@ -310,15 +310,15 @@ export class SlowmodePlugin extends ZeppelinPlugin<ISlowmodePluginConfig> {
const thisMsgLock = await this.locks.acquire(`message-${msg.id}`);
if (thisMsgLock.interrupted) return;
// Check if this channel even *has* a bot-maintained slowmode
const channelSlowmode = await this.slowmodes.getChannelSlowmode(channel.id);
if (!channelSlowmode) return thisMsgLock.unlock();
// Make sure this user is affected by the slowmode
const member = await this.getMember(msg.user_id);
const isAffected = this.hasPermission("is_affected", { channelId: channel.id, userId: msg.user_id, member });
if (!isAffected) return thisMsgLock.unlock();
// Check if this channel even *has* a bot-maintained slowmode
const channelSlowmode = await this.slowmodes.getChannelSlowmode(channel.id);
if (!channelSlowmode) return thisMsgLock.unlock();
// Delete any extra messages sent after a slowmode was already applied
const userHasSlowmode = await this.slowmodes.userHasSlowmode(channel.id, msg.user_id);
if (userHasSlowmode) {