From 0f5eb2aaae81685f61576d4e3cb870db8830fd47 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sat, 24 Jun 2017 21:18:00 +0000 Subject: [PATCH] A --- XiaoBot.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/XiaoBot.js b/XiaoBot.js index 55dcb86e..0f8b0453 100644 --- a/XiaoBot.js +++ b/XiaoBot.js @@ -52,11 +52,12 @@ client.on('warn', console.warn); client.on('commandError', (command, err) => console.error(command.name, err)); -client.on('message', (msg) => { - if (!msg.guild) return; - if (msg.author.bot || msg.member.hasPermission('ADMINISTRATOR')) return; +client.on('message', async (msg) => { + if (!msg.guild || msg.author.bot) return; const topic = msg.guild.defaultChannel.topic || ''; if (!topic.toLowerCase().includes('')) return; + const member = await msg.guild.fetchMember(msg.author); + if (member.hasPermission('ADMINISTRATOR')) return; if (/(discord(\.gg\/|app\.com\/invite\/|\.me\/))/gi.test(msg.content)) { if (msg.channel.permissionsFor(client.user).has('MANAGE_MESSAGES')) msg.delete(); msg.reply('Invites are prohibited from being posted here.');