]> ruin.nu Git - NDIRC.git/blobdiff - Bot.pm
Add dm replies for commands on discord
[NDIRC.git] / Bot.pm
diff --git a/Bot.pm b/Bot.pm
index 078563d8bdfa3e85e0f78da7c48d5cbd30b35799..1c54701f3251829af9c333e29a12b81d001ed031 100644 (file)
--- a/Bot.pm
+++ b/Bot.pm
@@ -371,7 +371,7 @@ sub discord_channel_create {
 sub handleCommand {
        my ($self, $c, $msg) = @_;
 
-       my ($p,$command,$args) = ($msg =~ /^([.])(\S+)(?: (.+))?/);
+       my ($p,$command,$args) = ($msg =~ /^([.!])(\S+)(?: (.+))?/);
 
        if ($msg =~ m{https?://[\w.]+/.+?scan(_id|_grp)?=(\w+)}){
                if (!$command || $command =~ m{^https?://}){
@@ -381,6 +381,8 @@ sub handleCommand {
                }
        }
 
+       $c->dm_reply(1) if $p eq '!';
+
        return 0 unless $self->disp->has_command($command,$c->channel);
 
        say localtime(time) . " - $msg";