Skip to content

Instantly share code, notes, and snippets.

@stintel
Last active April 19, 2016 14:37
Show Gist options
  • Save stintel/e98bc18b087b8f05e51ecdb4a6aba4b3 to your computer and use it in GitHub Desktop.
Save stintel/e98bc18b087b8f05e51ecdb4a6aba4b3 to your computer and use it in GitHub Desktop.
# damnslack.pl
#
# Removes Slack <-> IRC annoyances
use strict;
use vars qw($VERSION %IRSSI);
use Irssi;
$VERSION = '0.2';
%IRSSI = (
authors => 'stintel',
contact => 'stijn+irssi@linux-ipv6.be',
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');
@stintel
Copy link
Author

stintel commented Apr 19, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment