[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Random Kick Reason



On Fri, 2002-03-01 at 20:05, Roi Dayan wrote:
> Is there a script that reads a random kick reason from a file ?

I just wrote one for you, see attachment. :)
I think it's easy to understand (but my source sucks ;)) and you may
take an additional look at http://xchat.org/xchatdox2.html.

By the way: /kick <nick> without any reason adds a random-text, if you
send a reason by yourself it will be used instead of a random message.

Have fun,
Markus

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/GIT d-(--) s++:- a--- C+++ UL+++(++)>$ P+++ L+++(++)>++++ E W- N+ o+
K- 
w--- O- M+> V- PS+ PE Y++(+) PGP+++ t+ 5? X+ R- tv b+ DI++ D+ G+++ e*
h!(+) 
r- y+
------END GEEK CODE BLOCK------
#!/usr/bin/perl

# Random kick-msg script for XChat
# 2002 by dwz@cryptical.org... blah blah blah :)

$command="kick"; # What command should be used?
$random_file="/home/dwz/.xchat/kick.txt";

IRC::register("Random-Kick","0.1","","");
IRC::add_command_handler("$command", "kicksub");
IRC::print("Loading enhanced /$command...");

sub kicksub {
    my $comm_text=@_[0];
    $chan=IRC::get_info(2); 
    (@command)=split(/ /, $comm_text);
    if (@command[1] eq "") {
	open (FILE, "$random_file");
	@file=<FILE>;
	close (@file);
	my $rand=rand(@file);
	$rand_out=@file[$rand];
        IRC::command("/quote KICK $chan @command[0] :$rand_out");
    }
else {
    @command[1]=":@command[1]";
    IRC::command("/quote KICK $chan @command");
}
    return 1;
}