Last active
April 19, 2016 14:37
-
-
Save stintel/e98bc18b087b8f05e51ecdb4a6aba4b3 to your computer and use it in GitHub Desktop.
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
# damnslack.pl | |
# | |
# Removes Slack <-> IRC annoyances | |
use strict; | |
use vars qw($VERSION %IRSSI); | |
use Irssi; | |
$VERSION = '0.2'; | |
%IRSSI = ( | |
authors => 'stintel', | |
contact => '[email protected]', | |
name => 'damnslack', | |
description => 'Removes Slack <-> IRC annoyances', | |
license => 'GPL-3.0', | |
url => 'n/a', | |
changed => '19 April 2016 04:18:11', | |
); | |
Irssi::settings_add_str($IRSSI{'name'}, 'nickprefix', '$'); | |
my @channels = ('#decred'); | |
my @slackbots = ('decred-slack'); | |
my $nickprefix = Irssi::settings_get_str('nickprefix'); | |
sub replace_nick { | |
my ($server, $data, $nick, $address, $target) = @_; | |
my ($channel, $msg) = split(/ :/, $data,2); | |
# if the current channel is in the list... | |
for (@channels) { | |
if ($_ eq $channel) { | |
for (@slackbots) { | |
if ($_ eq $nick) { | |
my ($slacknick, $slackmsg) = split(/ /, $msg,2); | |
$data =~ s/$slacknick//; | |
$slacknick =~ s/^<//; | |
$slacknick =~ s/>$//; | |
$slacknick = "${nickprefix}${slacknick}"; | |
# emit signal | |
Irssi::signal_emit("event privmsg", $server, $data, | |
$slacknick, $address, $target); | |
#and stop | |
Irssi::signal_stop(); | |
} | |
} | |
} | |
} | |
} | |
Irssi::signal_add('event privmsg', 'replace_nick'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quick and dirty irssi script to show the Slack nickname instead of the slack-irc-bot nickname. Based on https://github.com/irssi/scripts.irssi.org/blob/gh-pages/scripts/washnicks.pl