From 05d96531479f6f3ae21b614527e2ea1e9da61581 Mon Sep 17 00:00:00 2001 From: Miikka Virtanen Date: Sun, 1 Jan 2017 06:23:40 +0200 Subject: [PATCH] Prevent commands in non-guild contexts --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index bd0bbbb..46db68f 100644 --- a/index.js +++ b/index.js @@ -375,6 +375,7 @@ bot.on('messageCreate', msg => { // These messages get relayed back to the DM thread between the bot and the user // Attachments are shown as URLs bot.registerCommand('reply', (msg, args) => { + if (! msg.channel.guild) return; if (msg.channel.guild.id !== modMailGuild.id) return; if (! msg.member.permission.has('manageRoles')) return; @@ -427,6 +428,7 @@ bot.registerCommand('reply', (msg, args) => { bot.registerCommandAlias('r', 'reply'); bot.registerCommand('close', (msg, args) => { + if (! msg.channel.guild) return; if (msg.channel.guild.id !== modMailGuild.id) return; if (! msg.member.permission.has('manageRoles')) return; @@ -457,6 +459,7 @@ Logs: <${logurl}>`; }); bot.registerCommand('block', (msg, args) => { + if (! msg.channel.guild) return; if (msg.channel.guild.id !== modMailGuild.id) return; if (! msg.member.permission.has('manageRoles')) return; @@ -481,6 +484,7 @@ bot.registerCommand('block', (msg, args) => { }); bot.registerCommand('unblock', (msg, args) => { + if (! msg.channel.guild) return; if (msg.channel.guild.id !== modMailGuild.id) return; if (! msg.member.permission.has('manageRoles')) return; @@ -505,6 +509,7 @@ bot.registerCommand('unblock', (msg, args) => { }); bot.registerCommand('logs', (msg, args) => { + if (! msg.channel.guild) return; if (msg.channel.guild.id !== modMailGuild.id) return; if (! msg.member.permission.has('manageRoles')) return;