DaWolf has asked for the wisdom of the Perl Monks concerning the following question:
my @masters = ("John","Paul","George","Ringo");
sub is_master { my $who = $_[0]; my $grant = 0; foreach my $master (@masters) { if ($who eq $master) #Here's the line 148 { $grant++; } } if ($grant > 0) { return 1; } else { return 0; } }
sub do_command { my ($conn, $event, $com) = @_; my $nick = $event->{nick}; if ($com eq "!rh") { if (is_master($nick)) #I don't have problems here { do_runlog(2, $event->{nick}); $conn->quit("Resetando..."); start_it(); } } elsif ($com eq "!sh") { if (is_master($nick)) #and here { do_runlog(3, $event->{nick}); $conn->quit("Saindo..."); } } elsif ($com =~ /^!ak/) { my ($scom, $p1, $p2) = split(/ /,$com); $conn->sl("MODE #$canal +b $p1"); $conn->sl("KICK #$canal $p1 $p2"); do_kick($p1); } elsif ($com =~ /^!dk/) { my ($scom, $p1, $p2) = split(/ /,$com); $conn->sl("MODE #$canal -b $p1"); if ($p2 ne "") { $conn->privmsg($p1, $p2); } undo_kick($p1); } elsif ($com eq "!help" || $com eq "!ajuda") { do_help($conn,$nick); } elsif ($com eq "!dig") { my ($scom, $p1) = split(/ /,$com); undo_ignore($conn,$event,$p1); } }
sub do_help { my ($conn, $nick) = @_; $conn->privmsg($nick, "LoBOT help:"); $conn->privmsg($nick, "------------------------------------------- +-----------------"); $conn->privmsg($nick, "Todos os comandos são iniciados por um pont +o de exclamação."); $conn->privmsg($nick, "O que está entre colchetes - [] - é opciona +l (os colchetes não devem ser digitados)."); $conn->privmsg($nick, "!ak nick [motivo] - adiciona um usuário no +akick do bot e kicka ele do canal com o motivo digitado"); $conn->privmsg($nick, "!dk nick [mensagem] - deleta um usuário do +akick do bot e caso mensagem tenha sido digitado, envia-a para o mesm +o por pvt."); $conn->privmsg($nick, "!help ou !ajuda - exibe este texto"); if (is_master($nick)) #Here's the line that calls the is_master su +b and starts my problem { $conn->privmsg($nick, "Os comandos válidos para os masters são +:"); $conn->privmsg($nick, "!dig nick - Deleta um usuário da lista +de ignores do bot"); $conn->privmsg($nick, "!sh - desativa o bot (Apenas para maste +rs)"); $conn->privmsg($nick, "!rh - reseta o bot (Apenas para masters +)"); } $conn->privmsg($nick, "------------------------------------------- +-----------------"); $conn->privmsg($nick, "Fim do help."); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with strict
by hardburn (Abbot) on Oct 28, 2003 at 19:09 UTC | |
by DaWolf (Curate) on Oct 28, 2003 at 19:12 UTC | |
|
Re: Help with strict
by graff (Chancellor) on Oct 29, 2003 at 01:22 UTC | |
by Nkuvu (Priest) on Oct 29, 2003 at 01:57 UTC | |
|
Re: Help with strict
by davido (Cardinal) on Oct 28, 2003 at 19:24 UTC | |
by DaWolf (Curate) on Oct 28, 2003 at 20:28 UTC | |
|
Re: Help with strict
by TomDLux (Vicar) on Oct 28, 2003 at 19:26 UTC | |
by hardburn (Abbot) on Oct 28, 2003 at 19:51 UTC | |
by chromatic (Archbishop) on Oct 28, 2003 at 20:06 UTC | |
|
Re: Help with strict
by Roger (Parson) on Oct 29, 2003 at 01:24 UTC | |
by sauoq (Abbot) on Oct 29, 2003 at 01:51 UTC |