summaryrefslogtreecommitdiffstats
path: root/scripts/hl.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:19:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:19:02 +0000
commit03929dac2a29664878d2c971648a4fe1fb698462 (patch)
tree02c5e2b3e006234aa29545f7a93a1ce01b291a8b /scripts/hl.pl
parentInitial commit. (diff)
downloadirssi-scripts-03929dac2a29664878d2c971648a4fe1fb698462.tar.xz
irssi-scripts-03929dac2a29664878d2c971648a4fe1fb698462.zip
Adding upstream version 20231031.upstream/20231031upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/hl.pl')
-rw-r--r--scripts/hl.pl53
1 files changed, 53 insertions, 0 deletions
diff --git a/scripts/hl.pl b/scripts/hl.pl
new file mode 100644
index 0000000..7fd898d
--- /dev/null
+++ b/scripts/hl.pl
@@ -0,0 +1,53 @@
+# CopyLeft Riku Voipio 2001
+# half-life bot script
+use strict;
+use Irssi;
+use Irssi::Irc;
+use vars qw($VERSION %IRSSI);
+
+# header begins here
+
+$VERSION = "1.2";
+%IRSSI = (
+ authors => "Riku Voipio",
+ contact => "riku.voipio\@iki.fi",
+ name => "half-life",
+ description => "responds to \"!hl counterstrike.server \" command on channels/msg's to query counter-strike servers",
+ license => "GPLv2",
+ url => "http://nchip.ukkosenjyly.mine.nu/irssiscripts/",
+ );
+
+
+my $qdir="/home/nchip/qstat/";
+
+sub cmd_hl {
+ my ($server, $data, $nick, $mask, $target) =@_;
+ if ($data=~/^!hl/){
+ my @foo=split(/\s+/,$data);
+ my $len=@foo;
+ if ($len==1){
+ $foo[1]="turpasauna.taikatech.com";
+ }
+ #fixme, haxxor protection
+ my $word=$foo[1];
+ $_=$word;
+ $word=~s/[^a-zA-ZäöÄÖ0-9\.]/ /g;
+ open(DAT, "-|", $qdir."qstat -hls $word");
+ my $count=0;
+ foreach my $line (<DAT>)
+ {
+ if ($count==1)
+ {
+ $_=$line;
+ $line=~s/\s+/ /g;
+ #print($line);
+ $server->command("/notice ".$target." ".$line);
+ }
+ $count++;
+ }
+ close(DAT);
+ }
+}
+
+Irssi::signal_add_last('message public', 'cmd_hl');
+Irssi::print("Half-life info bot by nchip loaded.");