Skip to content

Instantly share code, notes, and snippets.

@bradj
Created Oct 22, 2013
Embed
What would you like to do?
Publishes to SNS topic with associated message on regex match.
use strict;
use vars qw($VERSION %IRSSI);
use Irssi;
$VERSION = '1.00';
%IRSSI = (
authors => 'Brad Janke',
contact => 'brad.janke@gmail.com',
name => 'Irssns',
description => 'Sends SNS On Regex',
license => 'Public Domain',
);
Irssi::signal_add_last('script error', sub {
my ($data, $error);
return unless $error;
print $error;
});
Irssi::signal_add_last('message public', sub {
my ($data, $msg, $nick, $addr, $target) = @_;
return unless $msg;
if ( $msg =~ /(YourNickHere)/ ) {
system("aws", "sns", "publish", "--topic-arn", "YourSNSTopicARNHere", "--message", $nick . ': ' . $msg);
print 'Sent message';
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment