Hmm.. Just an idea (not sure if anybody has done this or not), but maybe a command for blocking a username could be something like ".block person@hotmail.com because they are using profanity." It could then do
Code:
$msg =~ s/\.block //ig;
Then split the username and the reason. It'd block and add the username to the block list, but then open up the file to store the reason! I'd also save the local time and the blocker into the file that contains reasons. This way, it would ensure that you had proof that a mod blocked somebody. Say they went evil and started blocking everybody like crazy, then said "But I didn't do it!".. Well you have proof! Lol
Hmm.. Just an idea (not sure if anybody has done this or not), but maybe a command for blocking a username could be something like ".block person@hotmail.com because they are using profanity." It could then do
Code:
$msg =~ s/\.block //ig;
Then split the username and the reason. It'd block and add the username to the block list, but then open up the file to store the reason! I'd also save the local time and the blocker into the file that contains reasons. This way, it would ensure that you had proof that a mod blocked somebody. Say they went evil and started blocking everybody like crazy, then said "But I didn't do it!".. Well you have proof! Lol
What if they just type ".block" (without a space)? Will it just add blank for the username and reason?
This would work better:
Code:
my ($command,$person,$reason) = split(/ /, $msg, 3);<br /><br />if (length $person == 0 || length $reason == 0) {<br /> return "You must provide a username AND reason.\n\n"<br /> . ".block myname\@nowhere.net being an idiot";<br />}<br />else {<br /> # The block code here, $person = person you're<br /> # blocking and $reason = why.<br />}
That would split the 3 variables you need at the spaces and then make sure the other two exist. So even if they type "!block" without a space, it will know that there's two variables missing.
Joined: 03 May 2006 Posts: 2292 Location: Colorado
Posted: Sun Feb 29, 2004 6:51 am Post subject:
or you could try something like
Code:
<br />elsif($msg =~ /^\#block\s+(.*)\s+(.*)$/)<br />{<br /> my $blockuser = $1;<br /> my $blockreason = $2;<br /> # do your stuff here<br />}<br />
That regex wont even match unless they include a username and reason, of course it also doesn't present an error so they may never learn the correct way to block a user. _________________ Eric256
Proud previous owner and current admin of Bot-depot.com
This is my crapy coding make it in the main morph folder
I do all i am suppose to do put the code at publics folder.... create bnotes inthe main folder of morphious but hwne i type !bnote i get notting notting 0 errors :S