1 #**************************************************************************
2 # Copyright (C) 2009 by Michael Andreen <harvATruinDOTnu> *
4 # This program is free software; you can redistribute it and/or modify *
5 # it under the terms of the GNU General Public License as published by *
6 # the Free Software Foundation; either version 2 of the License, or *
7 # (at your option) any later version. *
9 # This program is distributed in the hope that it will be useful, *
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 # GNU General Public License for more details. *
14 # You should have received a copy of the GNU General Public License *
15 # along with this program; if not, write to the *
16 # Free Software Foundation, Inc., *
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 #**************************************************************************/
24 use NDIRC::Dispatcher;
27 help => q(commands <command> | Gives help about all available commands or lists all commands available in the current channel),
29 }, class extends NDIRC::Command {
30 method execute ($c,$command) {
33 for (sort keys %{$c->disp->commands}){
34 next unless $c->disp->has_command($_,$c->channel);
35 my $acl = $c->disp->commands->{$_}->acl;
36 next if $acl && !$c->check_user_roles($acl);
40 $c->reply(join ', ', @commands);
41 }elsif (exists $c->disp->commands->{$command}){
42 $c->reply($c->disp->commands->{$command}->help);
48 help => q(Prints basic help),
50 }, class extends NDIRC::Command {
51 method execute ($c,$command) {
53 $c->reply("Use .commands <command> to show help about a specific command. "
54 . "Use .commands to list the diffenrent commands you have access to in this channel. "
55 . "Instead of . you can use ! to get reply in pm or ~ to get reply in channel.");
60 help => q(.say target message | sends message to target),
63 }, class extends NDIRC::Command {
64 method execute ($c,$msg) {
65 my ($target,$message) = $msg =~ /^(\S+)\s+(.+)$/ or die 'ARGS';
67 $c->message(privmsg => $target => $message );
72 help => q(.cmd command args | run a given irc command),
75 }, class extends NDIRC::Command {
76 method execute ($c,$msg) {
78 $c->command(split /\s/, $msg);
83 help => q(syntax: .anon nick message),
86 }, class extends NDIRC::Command {
87 method execute($c,$msg) {
88 my ($target,$mess) = $msg =~ /^(\S+) (.*)$/ or die 'ARGS';
90 $c->message(privmsg => $target, "<b>$mess</b> <c04>(reply with /msg "
91 .$c->channel.")</c>");
92 $c->message(privmsg => $c->channel, "<c03>$target << $mess</c>");