mIRC Home    About    Download    Register    News    Help

Print Thread
#245469 22/04/14 07:54 PM
Joined: Apr 2014
Posts: 33
B
bl968 Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Apr 2014
Posts: 33
This is my twitchtv.mrc file.

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.

Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
When I'm using this, I get this after a mod posts a link...




I also can't add anyone to a regulars list to enable them to post links safely.

Last edited by Bramzee; 22/04/14 08:40 PM.
Joined: Mar 2014
Posts: 52
P
Babel fish
Offline
Babel fish
P
Joined: Mar 2014
Posts: 52
if you use twitchclient 3, you can welcome new subscribers automatically right after they subd
nightbot doesnt do that at the moment

Code:
on *:text:*subscribed*:#: {
  if ($nick == twitchnotify) { 
    msg $chan hey $$1 thanks for subscribing blub
  }
}



you would need to change that code though
Code:
on *:text:SPECIALUSER & subscriber:#:{

to channel instead of query

Joined: Apr 2014
Posts: 33
B
bl968 Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Apr 2014
Posts: 33
Ya twitch client 3 is annoying and makes it almost impossible to debug chat actions in the bot. Multiple programmers have contacted twitch and asked that it be re-added to twitchclient 2

Joined: Mar 2014
Posts: 52
P
Babel fish
Offline
Babel fish
P
Joined: Mar 2014
Posts: 52
i just started another instance of mirc and have this sub welcome script running there on twitchclient 3
no problems laugh

Joined: Apr 2014
Posts: 33
B
bl968 Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Apr 2014
Posts: 33
If you are using the exact script above and have followed the instructions under it, you shouldn't have any problems.

Joined: Apr 2014
Posts: 33
B
bl968 Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Apr 2014
Posts: 33
small change to the first function.

Code:
on *:text:The moderators of this room are*:?:{
  if $hget(ops,0).item {
    /hfree ops
  }


modified to detect when a hash table is already gone

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
I just skip the check and /hfree -w table

And instead of telling people to insert commands into 'perform', you can just use the 'on start' event.

Joined: Apr 2015
Posts: 1
R
Mostly harmless
Offline
Mostly harmless
R
Joined: Apr 2015
Posts: 1
Sorry to bring back a dead thread, but I was wondering if this script still works, because when i tired it the link protection works (and subs can post) but not the commands.

Last edited by RarLian; 15/04/15 05:25 AM.

Link Copied to Clipboard