-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemotional.pl
59 lines (51 loc) · 1.54 KB
/
emotional.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use strict;
use warnings;
use English '-no_match_vars';
use Irssi;
our $VERSION = '1.1.0';
our %IRSSI = (
authors => 'Paul Backus',
contact => '[email protected]',
name => 'emotional',
description => 'Provides shortcuts for unicode emotes',
license => 'MIT',
url => 'https://raw.githubusercontent.com/pbackus/irssi-emotional/master/emotional.pl',
);
my %emotes = (
'check' => '☑',
'dongers' => 'ヽ༼ຈل͜ຈ༽ノ',
'fite' => '(ง•_•)ง',
'flip' => '(╯°□°)╯︵ ┻━┻',
'flower' => '(◕‿◕✿)',
'give' => '༼ つ ◕_◕ ༽つ',
'guns' => '(☞゚∀゚)☞',
'lenny' => '( ͡° ͜ʖ ͡°)',
'look' => 'ಠ_ಠ',
'nocheck' => '☐',
'notes' => '♫',
'roll' => '◔_◔',
'shades' => '(-■_■)',
'shrug' => '¯\_(ツ)_/¯',
'shrugs' => '¯\_(ツ)_/¯',
'tears' => 'ಥ_ಥ',
'thumbsup' => '👍',
'tickle' => '(ԅ ͡° ͜ʖ ͡°)ԅ',
'unflip' => '┬─┬ノ( º _ ºノ)',
);
sub render_emotes {
my ($text, $server, $win_item) = @_;
my ($name, $offset, $length);
while ($text =~ /:(\w+):/g) {
$name = $1;
$offset = $LAST_MATCH_START[0];
$length = $LAST_MATCH_END[0] - $offset;
if (exists $emotes{$name}) {
substr($text, $offset, $length) = $emotes{$name};
}
}
Irssi::signal_continue($text, $server, $win_item);
}
Irssi::signal_add('send text', \&render_emotes);
Irssi::signal_add('command me', \&render_emotes);
Irssi::signal_add('command msg', \&render_emotes);
Irssi::signal_add('command query', \&render_emotes);