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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
# Copyright (C) 2015 Dawid Lekawski
# contact: xxrud0lf@gmail.com
#
# --- INFORMATION ---
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# --- END OF INFORMATION ---
#
# Emote script - replace :emote_name: in your sent messages into predefined
# emotes (mostly but not limited to unicode). Result is visible both for you
# and channel/query target users.
#
# Feel free to modify or add your own ones!
#
# (that's a lot of "emote" word, isn't it?)
#
# commands:
#
# - /emotes - shows list of emotes in status window
#
# notes:
#
# - script doesn't work with /msg target text; must be typed in a channel
# or query window
#
# - Ctrl+O (ascii 15) at the beggining of your text turns off emote replacing
# for this text
#
# - remeber to escape "\" characters in emotes (just type it twice -> "\\"),
# take a look at 'shrug' emote for reference
#
use strict;
use warnings;
use utf8;
use Irssi qw(signal_add signal_continue command_bind);
our $VERSION = "1.00";
our %IRSSI = (
authors => "Dawid 'rud0lf' Lekawski",
contact => 'rud0lf/IRCnet; rud0lf/freenode; xxrud0lf@gmail.com',
name => 'emotes script',
description => 'Replaces :emote_name: text in your sent messages into pre-defined emotes (unicode mostly).',
license => 'GPLv3'
);
my $pattern = '';
my %emotes = (
'huh', '°-°',
'lenny', '( ͡° ͜ʖ ͡°)',
'shrug', '¯\\_(ツ)_/¯',
'smile', '☺',
'sad', '☹',
'heart', '♥',
'note', '♪',
'victory', '✌',
'coffee', '☕',
'kiss', '💋',
'inlove', '♥‿♥',
'annoyed', '(¬_¬)',
'bear', 'ʕ•ᴥ•ʔ',
'animal', '(•ω•)',
'happyanimal', '(ᵔᴥᵔ)',
'strong', 'ᕙ(⇀‸↼‶)ᕗ',
'happyeyeroll', '◔ ⌣ ◔',
'tableflip', '(╯°□°)╯︵ ┻━┻',
'tableback', '┬──┬ ノ( ゜-゜ノ)',
'tm', '™',
'birdflip', '╭∩╮(-_-)╭∩╮',
'lolshrug', '¯\\(°_o)/¯',
'shades', '(⌐■_■)',
'smoke', '🚬',
'poop', '💩',
'drops', '💦',
'yuno', 'щ(゚Д゚щ)',
'dead', '✖_✖',
'wtf', '☉_☉',
'disapprove', '๏̯͡๏',
'wave', '(•◡•)/',
'shock', '⊙▃⊙',
'wink', '◕‿↼',
'gift', '(´・ω・)っ由',
'success', '(•̀ᴗ•́)و',
'whatever', '◔_◔'
);
sub init {
$pattern = join('|', keys %emotes);
if ($pattern eq '') {
$pattern = '!?';
}
}
sub process_emotes {
my ($line) = @_;
# don't process line starting with Ctrl+O (ascii 15)
if ($line =~ /^\x0f/) {
return $line;
}
$line =~ s/:($pattern):/$emotes{$1}/g;
return $line;
}
sub sig_send_text {
my ($line, $server, $witem) = @_;
return unless ($witem);
return unless ($witem->{type} eq "CHANNEL" or $witem->{type} eq "QUERY");
my $newline = process_emotes($line);
signal_continue($newline, $server, $witem);
}
sub pad {
my ($txt, $cnt) = @_;
if (length($txt) >= $cnt) {
return $txt;
}
$txt .= " " x ($cnt - length($txt));
return $txt;
}
sub cmd_emotes {
my ($data, $server, $witem) = @_;
Irssi::print('List of emotes:', MSGLEVEL_CLIENTCRAP);
foreach my $key (sort(keys %emotes)) {
my $emote = $emotes{$key};
Irssi::print('* '. pad($key, 15) . ' : ' . $emote, MSGLEVEL_CLIENTCRAP);
}
Irssi::print('Total of '.scalar(keys %emotes).' emotes.', MSGLEVEL_CLIENTCRAP);
}
init();
signal_add("send text", "sig_send_text");
command_bind("emotes", "cmd_emotes");
|