Created
October 22, 2013 21:20
-
-
Save bradj/7108379 to your computer and use it in GitHub Desktop.
Publishes to SNS topic with associated message on regex match.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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