Browse Source

Disable commands in DM

ghorsington 4 năm trước cách đây
mục cha
commit
a8e5b7d39c
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  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;