Parcourir la source

Add messages when commands don't work in DM

ghorsington il y a 3 ans
Parent
commit
e635090685
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      bot/src/plugin_manager.ts

+ 4 - 1
bot/src/plugin_manager.ts

@@ -3,6 +3,7 @@ import fs from "fs";
 import { Message, Client, ClientEvents } from "discord.js";
 import { EventType, BotEvent, ICommand, isPlugin, BotEventData, isCustomEvent, IPlugin, CommandType } from "./model/plugin";
 import { isAuthorisedAsync } from "./util";
+import { tryDo } from "../../shared/lib/src/common/async_utils";
 
 
 interface IDocumentationData {
@@ -128,8 +129,10 @@ export class PluginManager {
             }
 
             if (match) {
-                if (!c.allowDM && m.channel.type == "dm")
+                if (!c.allowDM && m.channel.type == "dm") {
+                    await tryDo(m.reply("Sorry, this command is not available in DMs for now."));
                     return false;
+                }
                 if (c.auth && !(await isAuthorisedAsync(m.member)))
                     return false;
                 const eventResult = c.action({ message: m, contents: matchData });