Parcourir la source

Disable commands in DM

ghorsington il y a 4 ans
Parent
commit
a8e5b7d39c
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  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;