Script: ragefaces.pl

Send ragefac.es URLs.
Author: stfn — Version: 1.0 — License: GPL-3.0-or-later
For WeeChat ≥ 0.3.0.
Tags: ragefaces
Added: 2011-07-13

Download GitHub Repository

 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
#
# Copyright (C) 2011 by stfn <stfnmd@googlemail.com>
#
# 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/>.
#

use strict;
use warnings;

my $script_name = 'ragefaces';
my $author = 'stfn <stfnmd@googlemail.com>';
my $version = '1.0';
my $license = 'GPL3';
my $description = 'Send ragefac.es';

my %RAGEFACES = (
	lol => '23',
	troll => '100',
	okay => '43',
	gtfo => '67',
	fap => '137',
	lulz => '151',
	foreveralone => '45',
	fuckyea => '57',
	pedobear => '114',
	donotwant => '31',
	yuno => '106',
	instantclassy => '151',
	challengeaccepted => '127',
	actually => '148',
	areyoukiddingme => '126',
	fuck => '74',
	pfchch => '64'
);
my $URL = 'http://ragefac.es/';

# register script
weechat::register($script_name, $author, $version, $license, $description, "", "");

# hooks
weechat::hook_command("rage", "Send ragefac.es", "<rageface>", "Use TAB-completion for help with the available ragefaces.", completion(), "rage_cmd", "");

# subroutines
sub completion
{
	my $str = "";
	while (my ($key, $value) = each(%RAGEFACES)) {
		$str .= $key . "|";
	}
	chop($str);
	return $str;
}

sub rage_cmd
{
	my $buffer = $_[1];
	my $arg = $_[2];

	if (exists $RAGEFACES{$arg}) {
		weechat::command($buffer, $URL . $RAGEFACES{$arg})
	}
	elsif ($arg =~ /^\d+$/) {
		weechat::command($buffer, $URL . $arg);
	}
}