mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Alright, so I'm kind of new to this. And by that I mean I used to mess around back in the day. But it's been awhile. So heres the details of my problem.

I have a link block script set up for my twitch channel (yeah... another one of these topics, sorry). Works great. Except I can't get ANYONE other than mods (thanks to a bit of research on here) to be able to post links. I can't get the script to recognize my regulars list or even a !permit command.

Quote:
on *:TEXT:!reg add*:#: {
if ($nick isop #) {
write regulars.txt $$3
msg $chan $$3 has been added to the regular list!
}
if ($read(regulars.txt,nw,$nick)) {
write regulars.txt $$3
msg $chan $$3 has been added to the regular list!
}
}
on *:TEXT:!reg del*:#: {
if ($nick isop #) {
if ($read(regulars.txt,nw,$3)) write -dl $+ $readn regulars.txt
msg # $$3 has been removed from the regular list!
}
if ($read(regulars.txt,nw,$nick)) {
if ($read(regulars.txt,nw,$3)) write -dl $+ $readn regulars.txt
msg # $$3 has been removed from the regular list!
}
}

on *:TEXT:!permit*:#: {
if ($nick isop #) && ($2) {
write permitlist.txt $2
msg # $2 has been permited to post a link for 30 seconds
.timerRemovePermit 1 30 RemovePermit # $2
}
}

alias -l RemovePermit {
write $+(-ds,$2) permitlist.txt
msg $1 $2 is no longer allowed to post a link
}

on 1:TEXT:!regular*:#:{
if $nick !isop # { 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:*:#:{
/set %linker $chr(124) $+ $nick $+ $chr(124)

if $hget(subscribers,$nick) {
/halt
}
if $hget(regulars,$nick) {
/halt
}
if $nick isop # { 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 $+ ! Please explain what the link is for and ask a moderator for permission to post a link first.
/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.
/msg $chan .timeout $nick %banlength
/halt
}
/set %Linkers $remove( %Linkers, $chr(124) $+ $$2 $+ $chr(124) )
}

on 1:action:*:#:{
/set %linker $chr(124) $+ $nick $+ $chr(124)

if $hget(subscribers,$nick) {
/halt
}
if $hget(regulars,$nick) {
/halt
}
if $nick isop # { 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 $+ ! Please explain what the link is for and 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.
/msg $chan .timeout $nick %banlength
/halt
}
/set %Linkers $remove( %Linkers, $chr(124) $+ $$2 $+ $chr(124) )
}


Any help or ideas are appreciated. I'd really like to get this working.

Joined: Apr 2014
Posts: 33
B
Ameglian cow
Offline
Ameglian cow
B
Joined: Apr 2014
Posts: 33
isop is not going to work on twitch if you want to detect subscribers (twitchclient 2). You don't have a user list mirc can check against which is why I wrote....

https://forums.mirc.com/ubbthreads.php/topics/245316/Building_Moderator_Hash_Table_#Post245316

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




If you load this code you have a basic twitch tv bot then you can expand it from there.

Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Thank you bl. I'll try this out.

EDIT:

I'm really out of my element here. I don't believe I have the option to add regulars ( !reg add USERNAME ) which is really my main focus right now, since I don't have to worry about subscribers for awhile. I was able to before, with the old script. However, they weren't able to post links without getting banned for some odd reason.


Last edited by Bramzee; 22/04/14 08:08 PM.

Link Copied to Clipboard