X-Git-Url: https://ruin.nu/git/?p=NDIRC.git;a=blobdiff_plain;f=Bot.pm;h=363531217864018f1faf26ab54ec00a37cbeae9d;hp=cbc0c5cd90332910e76871d705cd398bbe36cb4c;hb=c9c9e83da024d15fc1245bf456c197c119f23cf4;hpb=4c84eb6e64b730b9b8726d30e70c355a5056b83c diff --git a/Bot.pm b/Bot.pm index cbc0c5c..3635312 100644 --- a/Bot.pm +++ b/Bot.pm @@ -370,6 +370,26 @@ sub discord_channel_create { $self->discord_channels->{$chan->{id}} = $chan; } +sub handleCommand { + my ($self, $c, $msg) = @_; + + my ($p,$command,$args) = ($msg =~ /^([.])(\S+)(?: (.+))?/); + + if ($msg =~ m{https?://[\w.]+/.+?scan(_id|_grp)?=(\w+)}){ + if (!$command || $command =~ m{^https?://}){ + ($p,$command,$args) = ('.','addscan',$msg); + }elsif($command ne 'addscan'){ + $self->handleCommand ($c, ".addscan $msg") + } + } + + return 0 unless $self->disp->has_command($command,$c->channel); + + say localtime(time) . " - $msg"; + + return $self->disp->run_command($c,$command,$args); +} + sub parseCommand { my ($self, $msg, $server, $nick, $address, $channel, $model) = @_;