Trying to learn Irssi scripting... reddit / irc ---------------------------------------------------------------------- rkos · 2015-04-15 15:51 Hi, so how would I make a script that parses channel messages for a certain word and then responds? I tried event_privmsg but that only worked in PMs, I'm trying on_public now but can't get it to work at all. Also for the response how would I make it so that it finds which channel the certain word was posted on and responds in that channel? Here's what I wrote: use Irssi; sub on_public { my ($server, $data, $nick, $mask, $target) =@_; my ($target, $text) = $data =~ /^(\S*)\s:(.*)/; if ($text =~ /^!script$/i) { $server->command ( "MSG $target The script works but does nothing interesting...\n" ); } } ---------------------------------------------------------------------- shobble · 2015-04-15 17:58 try starting here: https://github.com/shabble/irssi- docs/wiki/Guide#Responding_to_a_public_message ---------------------------------------------------------------------- rkos · 2015-04-17 09:07 Thanks, I'm still not quite understanding it, I guess I'll look more into the basics of Perl first or something. ---------------------------------------------------------------------- ne7split · 2015-04-22 10:27 You can catch message input in a channel with something like #!/usr/bin/perl -w use strict; use Irssi; sub some_subroutine_name_here { my ($server, $msg, $nick, $address, $target) = @_; if ($msg eq "!command") { $server->command("msg $target hello world"); } } Irssi::signal_add('message public', 'some_subroutine_name_here'); I've been playing with Perl for a short while (nothing to write home about, just making a similar kind of bot with some regex matching).