diff options
author | Joe Rayhawk <jrayhawk+git@omgwallhack.org> | 2020-10-24 23:57:08 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk+git@omgwallhack.org> | 2020-10-24 23:57:08 -0700 |
commit | 004705ff1d0d227fa186384121fae939b9314e7d (patch) | |
tree | 5ca62c6346282f6975a8b5a9458470168d65b465 /irssi/irssi-serverevent.pl | |
parent | 93aebe7498b3f3bf5079e4f218072b0ec5ad9b6c (diff) | |
download | twitchtools-004705ff1d0d227fa186384121fae939b9314e7d.tar.gz twitchtools-004705ff1d0d227fa186384121fae939b9314e7d.zip |
A handful of Irssi plugins.
irssi-jtv.pl is able to repeat host information
irssi-serverevent.pl is used for triggering or debugging based on ircv3 server events.
Diffstat (limited to 'irssi/irssi-serverevent.pl')
-rw-r--r-- | irssi/irssi-serverevent.pl | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/irssi/irssi-serverevent.pl b/irssi/irssi-serverevent.pl new file mode 100644 index 0000000..7fbbbd4 --- /dev/null +++ b/irssi/irssi-serverevent.pl @@ -0,0 +1,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'); + |