Explorar o código

Disable commands in DM

ghorsington %!s(int64=4) %!d(string=hai) anos
pai
achega
a8e5b7d39c
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      bot/src/main.ts

+ 6 - 0
bot/src/main.ts

@@ -50,6 +50,12 @@ client.bot.on("ready", async () => {
 });
 
 client.bot.on("message", async m => {
+    if (m.channel.type != "text") {
+        logger.warn("User %s (%s#%s) tried to execute command in DMs. Message: %s.", m.author.id, m.author.username, m.author.discriminator, m.content);
+        await m.reply("DM commands are disabled, sorry!");
+        return;
+    }
+
     if (m.author.id == client.botUser.id)
         return;