From 004705ff1d0d227fa186384121fae939b9314e7d Mon Sep 17 00:00:00 2001 From: Joe Rayhawk Date: Sat, 24 Oct 2020 23:57:08 -0700 Subject: 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. --- irssi/irssi-jtv.pl | 29 ++++++++++++++++++++ irssi/irssi-serverevent.pl | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 irssi/irssi-jtv.pl create mode 100644 irssi/irssi-serverevent.pl (limited to 'irssi') diff --git a/irssi/irssi-jtv.pl b/irssi/irssi-jtv.pl new file mode 100644 index 0000000..e9e72f5 --- /dev/null +++ b/irssi/irssi-jtv.pl @@ -0,0 +1,29 @@ +use Irssi 0.8.10 (); +use strict; + +use vars qw($VERSION %IRSSI); + +$VERSION="0.1.7"; +%IRSSI = ( + authors=> 'jrayhawk', + name=> 'jtv', + description=> 'repeats JTV information', + license=> 'GPL v2', +); + +sub jtv_say { + my ($server, $msg, $nick, $address) = @_; + + return if ($nick ne 'jtv'); + + return if ($msg !~ /(.+) is now hosting you for (.+) viewers\./ ); + + open(FILE, "~/.config/twitch/channel"); + my $channel = ; + $channel = chomp($channel); + close(FILE); + + $server->command("msg $channel Welcome, $2 viewers! Thanks for the host, $1!"); +} + +Irssi::signal_add_last('message private', 'jtv_say'); 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 = ; + 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'); + -- cgit v1.2.3