Basic Twitch TV Bot - 22/04/14 07:54 PM
This is my twitchtv.mrc file.
To use this you must be set some items in your perform on connect...
you have to set a variable to store the banlength.
type one of the following in a channel
Then you have to set %linkdelay (How long they have to post a link after being permitted)
Replace [yourbroadcaster name] with your broadcaster name, and #yourchannel with #yourchannelname
If you load this code you have a basic twitch tv bot then you can expand it from there.
Code:
on *:text:The moderators of this room are*:?:{ /hfree ops /hmake ops if ($nick != jtv) return /hadd -m ops [yourbroadcaster name] $ctime /var %count = $numtok($remove( $7- , $chr(32) ) , 44) var %i = 1 while (%i <= %count) { hadd -m ops $gettok($remove( $7- , $chr(32) ) ,%i,44) $ctime inc %i } echo -a The number of ops is %count } on *:text:SPECIALUSER & subscriber:?:{ if ($nick != jtv) return hadd -m subscribers $2 $ctime } on 1:JOIN:#:{ /hdel subscribers $nick } on 1:TEXT:!permit*:#:{ if !$hget(ops,$nick) { /halt } /set %Linkers %Linkers $chr(124) $+ $$2 $+ $chr(124)) /msg $chan $$2 you have %linkdelay seconds to post a link /timer $+ $$2 1 %linkdelay /set %Linkers $remove(%Linkers, $chr(124) $+ $$2 $+ $chr(124) ) } on 1:TEXT:!regular*:#:{ if !$hget(ops,$nick) { /halt } if $hget(regulars,$$2) { /hdel regulars $$2 /msg $chan $$2 removed from the list of users permitted to always post links /halt } if !$hget(regulars,$$2) { /hadd -m regulars $$2 $ctime /msg $chan $$2 added to list of users permitted to always post links /halt } } on 1:TEXT:!ban*:#:{ if !$hget(ops,$nick) { /halt } /msg $chan .ban $$2 } on 1:TEXT:!checksub*:#:{ if !$hget(ops,$nick) { /halt } if $hget(subscribers, $$2) { /msg $chan $$2 is a current subscriber! /halt } if !$hget(subscribers, $$2) { /msg $chan $$2 is either not a current subscriber, or the bot just hasn't seen them in a while. /halt } } on 1:TEXT:!unban*:#:{ if !$hget(ops,$nick) { /halt } /msg $chan .unban $$2 } on 1:TEXT:!timeout*:#:{ if !$hget(ops,$nick) { /halt } /msg $chan .timeout $$2 $$3 } on 1:TEXT:*:#:{ /set %linker $chr(124) $+ $nick $+ $chr(124) if $hget(subscribers,$nick) { /halt } if $hget(regulars,$nick) { /halt } if $hget(ops, $nick) { /halt } if %linker isin %Linkers { /halt } if $regex(url, $1-, \b[a-zA-Z0-9._%+-]+\.(?:[a-zA-Z]{2}|aero|asia|biz|cat|com|coop|eus|gal|info|int|jobs|mobi|museum|name|net|org|post|pro|tel|travel|xxx|edu|gov|mil)\b) { /msg $chan You are not permitted to post links $nick $+ ! Either subscribe (Subscribers can always post links), or ask a moderator for permission to post a link first. (Banned from posting for %bandelay seconds) /msg $chan .timeout $nick %banlength /halt } if http: isin $1- { /msg $chan You are not permitted to post links $nick $+ ! Ask a moderator for permission first. (Banned from posting for %banlength seconds) /msg $chan .timeout $nick %banlength /halt } /set %Linkers $remove( %Linkers, $chr(124) $+ $$2 $+ $chr(124) ) if $calc($ctime - $hget(subscribers,$nick)) > 86400 { /hdel subscribers $nick } } on 1:action:*:#:{ /set %linker $chr(124) $+ $nick $+ $chr(124) if $hget(subscribers,$nick) { /halt } if $hget(regulars,$nick) { /halt } if $hget(ops, $nick) { /halt } if %linker isin %Linkers { /halt } if $regex(url, $1-, \b[a-zA-Z0-9._%+-]+\.(?:[a-zA-Z]{2}|aero|asia|biz|cat|com|coop|eus|gal|info|int|jobs|mobi|museum|name|net|org|post|pro|tel|travel|xxx|edu|gov|mil)\b) { /msg $chan You are not permitted to post links $nick $+ ! Either subscribe (Subscribers can always post links), or ask a moderator for permission to post a link first. (Banned from posting for %bandelay seconds) /msg $chan .timeout $nick %banlength /halt } if http: isin $1- { /msg $chan You are not permitted to post links $nick $+ ! Ask a moderator for permission first. (Banned from posting for %banlength seconds) /msg $chan .timeout $nick %banlength /halt } /set %Linkers $remove( %Linkers, $chr(124) $+ $$2 $+ $chr(124) ) if $calc($ctime - $hget(subscribers,$nick)) > 86400 { /hdel subscribers $nick } }
To use this you must be set some items in your perform on connect...
Code:
/raw twitchclient 2 /timerresetsubs 1 86400 /hfree subscribers /join #yourchannel /timer 1 5 /msg #yourchannel .mods
you have to set a variable to store the banlength.
type one of the following in a channel
Code:
/set %banlength 30 for 30 seconds /set %banlength 300 for 5 minutes
Then you have to set %linkdelay (How long they have to post a link after being permitted)
Code:
/set %linkdelay 30 for 30 seconds
Replace [yourbroadcaster name] with your broadcaster name, and #yourchannel with #yourchannelname
If you load this code you have a basic twitch tv bot then you can expand it from there.