-
Notifications
You must be signed in to change notification settings - Fork 236
/
Copy pathdiscord_unhilight.pl
36 lines (30 loc) · 1.12 KB
/
discord_unhilight.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use strict;
use warnings;
use Irssi;
our $VERSION = '0.1b';
our %IRSSI = (
authors => 'Christoffer Holmberg',
contact => 'skug+irssiscripts@skug.fi',
name => 'discord_unhilight.pl',
description => 'Strips the annoying mentions of your nickname via <yournick> on irc<->discord bridge, will work for any bridge using botnick: <yournick>',
license => 'Public Domain',
url => 'http://scripts.irssi.org & https://github.com/mskug/scrips.irssi.org/blob/master/scripts/discord_unhilight.pl',
);
# HOWTO:
#
# /load discord_unhilight.pl
#
# This should just automatically work
#
# NOTE:
#
# Based on slack_strip_auto_cc.pl by Ævar Arnfjörð Bjarmason.
sub msg_strip_nick_from_discord_bridge {
my ($server, $data, $nick, $nick_and_address) = @_;
my ($target, $message) = split /:/, $data, 2;
my $wanted_nick = $server->{wanted_nick};
return unless $message =~ s/^<\Q$wanted_nick\E>/-You-:/;
my $new_data = "$target:$message";
Irssi::signal_continue($server, $new_data, $nick, $nick_and_address);
}
Irssi::signal_add('event privmsg', 'msg_strip_nick_from_discord_bridge');