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
|
use Irssi 0.8.10 ();
use strict;
use vars qw($VERSION %IRSSI);
$VERSION="0.0.1";
%IRSSI = (
authors=> 'jrayhawk',
name=> 'Twitch serverevent hook',
description=> 'Notifies on host events',
license=> 'GPL v2',
);
sub server_notification {
my ( $server, $msg, $nick, $address ) = @_;
# Irssi::print( "Address: $address ServerRealAddress: " . $server->{real_address} . " Nick: $nick Msg: $msg", MSGLEVEL_CLIENTCRAP );
return if ( $nick ne 'tmi.twitch.tv' );
return if ( $server->{real_address} ne 'tmi.twitch.tv' );
#01:21 [twitch] -!- HOSTTARGET #masterzeals :bungmonkey 0
#01:10 [twitch] -!- HOSTTARGET #videogamegeek1970 :sohoppy 36
#01:16 [twitch] -!- HOSTTARGET #abbycaketv :- 0
if ( $msg =~ /^HOSTTARGET #(.+) :bungmonkey (.+)/ ) {
my $count="0";
$count=$2 if defined $2;
if ( ( $count == 0 ) || $count == 500000 ) {
open( HOSTLIST, '>>', "$ENV{'HOME'}/.config/twitch/hostlist" );
unless ( -s "$ENV{'HOME'}/.config/twitch/hostlist" ) {
print( HOSTLIST "$1" );
} else {
print( HOSTLIST ", $1" );
};
close( HOSTLIST );
} else {
open(FILE, "$ENV{'HOME'}/.config/twitch/channel");
my $channel = <FILE>;
chomp($channel);
close(FILE);
$server->command("msg #$channel Welcome, $count viewers! Thanks for the host, $1!");
};
};
# 03:54 [twitch] -!- WHISPER bungmonkey :Hellu
if ( $msg =~ /^WHISPER/ ) {
Irssi::print( "whisper $address $server->{real_address} $nick $msg", MSGLEVEL_HILIGHT );
Irssi::print( "Address: $address ServerRealAddress: $server->{real_address} Nick: $nick Msg: $msg", MSGLEVEL_CLIENTCRAP );
};
# IRCv3 tags:
# 01:42 [twitch] -!- @badge-info=subscriber/32;badges=broadcaster/1,subscriber/12,premium/1;color=;display-name=BungMonkey;emotes=;flags=;id=9981e2a2-acb2-4449-942e-d6f903ae98b4;mod=0;room-id=59895482;subscriber=1;tmi-sent-ts=1581154924647;turbo=0;user-id=59895482;user-type= :bungmonkey!bungmonkey@bungmonkey.tmi.twitch.tv PRIVMSG #bungmonkey :test
# 01:43 [twitch] -!- @badge-info=;badges=moderator/1,premium/1;color=;display-name=BungMonkey;emote-sets=0,19194,109561,128557,137403,177895,252129,252130,252131,421521,516382,578558,793579,952211,1013037,1080649,300088375,300206305,300432482,300548761,300611550,472873131,488737509;mod=1;subscriber=0;user-type=mod :tmi.twitch.tv USERSTATE #ionox
# 01:43 [twitch] -!- @emote-only=0;followers-only=-1;r9k=0;rituals=0;room-id=21704724;slow=0;subs-only=0 :tmi.twitch.tv ROOMSTATE #ionox
# 01:44 [twitch] -!- @badge-info=;badges=moderator/1,premium/1;color=;display-name=BungMonkey;emotes=;flags=;id=96a77285-7621-4fcc-877b-e6db541aa6c9;mod=1;room-id=21704724;subscriber=0;tmi-sent-ts=1581155046275;turbo=0;user-id=59895482;user-type=mod :bungmonkey!bungmonkey@bungmonkey.tmi.twitch.tv PRIVMSG #ionox :test
# 01:50 [twitch] -!- @ban-duration=1;room-id=59895482;target-user-id=466763439;tmi-sent-ts=1581155422079 :tmi.twitch.tv CLEARCHAT #bungmonkey :feet
# 01:55 [twitch] -!- @badge-info=;badges=vip/1,premium/1;color=;display-name=BungMonkey;emote-sets=0,19194,109561,128557,137403,177895,252129,252130,252131,421521,516382,578558,793579,952211,1013037,1080649,300088375,300206305,300432482,300548761,300611550,472873131,488737509;mod=0;subscriber=0;user-type= :tmi.twitch.tv USERSTATE #bbalmung
# 01:55 [twitch] -!- @badge-info=;badges=vip/1,premium/1;color=;display-name=BungMonkey;emotes=;flags=;id=07d4dfa1-a985-4225-a880-0c2bc73d54c3;mod=0;room-id=107848476;subscriber=0;tmi-sent-ts=1581155731665;turbo=0;user-id=59895482;user-type= :bungmonkey!bungmonkey@bungmonkey.tmi.twitch.tv PRIVMSG #bbalmung :test
};
Irssi::signal_add_last('server event', 'server_notification');
|