Skip to content

Instantly share code, notes, and snippets.

@bradj
Created October 22, 2013 21:20
Show Gist options
  • Save bradj/7108379 to your computer and use it in GitHub Desktop.
Save bradj/7108379 to your computer and use it in GitHub Desktop.
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