-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddsmiley.pl
More file actions
57 lines (47 loc) · 1.52 KB
/
addsmiley.pl
File metadata and controls
57 lines (47 loc) · 1.52 KB
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
# AddSmiley 1.0
# by tsjost
# Usage:
# The best interface is no interface. There's nothing fancy here, just use it! (And tell me how awesome it is)
#
# Settings:
# addsmiley_on (ON)
# ON: It's on and should do what it should.
# OFF: The opposite to on.
#
# addsmiley_smiley (":)")
# xx: This is the actual string that's going to be appended to some of your lines.
#
# addsmiley_percentage (30)
# xx: The percentage (probably between and including 0 and 100) of how many lines get a smiley appended.
#
# Notes:
# Whenever you type your own smiley at the end of the line (/(.(:|=)|(:|=).)$/), we won't put another there.
#
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "1.0";
%IRSSI = (
authors => 'tsjost',
name => 'AddSmiley',
description => 'Adds a smiley to some lines, to make yourself appear less negative.',
url => 'https://github.com/tsjost/AddSmiley'
);
sub event_output_msg {
if (!Irssi::settings_get_bool("addsmiley_on")) {
return;
}
if (int(rand(101)) > Irssi::settings_get_int("addsmiley_percentage")) {
return;
}
my ($msg, $server, $witem) = @_;
if ($msg =~ /(.(:|=)|(:|=).)$/) {
return;
}
my $smiley = Irssi::settings_get_str("addsmiley_smiley");
$witem->command("MSG ".$witem->{name}." ".$msg." ".$smiley);
Irssi::signal_stop();
}
Irssi::signal_add("send text", "event_output_msg");
Irssi::settings_add_bool("addsmiley", "addsmiley_on", 1);
Irssi::settings_add_str("addsmiley", "addsmiley_smiley", ":)");
Irssi::settings_add_int("addsmiley", "addsmiley_percentage", 30);