mIRC Homepage
Posted By: judge2020 Fully working link block? - 24/03/14 12:39 PM
I've looked all over the forums for a twitch.tv link block that works but none have.

If someone could make one that would /timeout $nick 1
and have a !permit (nick) [would expect a $$2 in there]


Here is a broken one someone could just fix up if they don't want to make a whole new one http://pastebin.com/1R9S8TY4
Posted By: Nillen Re: Fully working link block? - 24/03/14 10:55 PM
The code you presented is already fully working.
Posted By: judge2020 Re: Fully working link block? - 26/03/14 12:10 AM
When i put it in my script and someone post a link it does not to the person or say the message...
Posted By: Nillen Re: Fully working link block? - 26/03/14 04:31 PM
Do you have any other scripts starting with
Code:
 on *:text:*:#: 
?

This code will interpret any text made in the chat, thus having any code under this code won't ever be interpreted.
Posted By: judge2020 Re: Fully working link block? - 28/03/14 08:19 PM
yes, i do have TEXT commands. So you say if the script is above the text commands then it will work? I also don't want to break those commands.
Posted By: Nillen Re: Fully working link block? - 28/03/14 08:52 PM
Combine them then. I assume the other commands you set up use aliases as well?

Then you can just combine it by
Code:
on *:text:*:#: { 
linkpost $1-
otheralias $1- 
}


Or you can just take the parts you want out of the alias and make your own code.

Code:
    var %links /(?<=^|\s)((?>\S{3,8}:\/\/|w{3}\56)\S+)|\56( $+ %domains $+ )\b/iS
    if ($regex($1-,%links)) { 
      .msg # /timeout $nick 1

Is quite literally all you'll need to make a link block.
Posted By: judge2020 Re: Fully working link block? - 31/03/14 10:19 PM
Originally Posted By: Nillen
Combine them then. I assume the other commands you set up use aliases as well?

Then you can just combine it by
Code:
on *:text:*:#: { 
linkpost $1-
otheralias $1- 
}



Or you can just take the parts you want out of the alias and make your own code.

Code:
    var %links /(?<=^|\s)((?>\S{3,8}:\/\/|w{3}\56)\S+)|\56( $+ %domains $+ )\b/iS
    if ($regex($1-,%links)) { 
      .msg # /timeout $nick 1

Is quite literally all you'll need to make a link block.

None of my other commands use aliases. So how would i go about this now?
Posted By: LostServ Re: Fully working link block? - 02/04/14 05:54 PM
Originally Posted By: judge2020

None of my other commands use aliases. So how would i go about this now?


The easiest way is to just put the link script into a new remote file. (File > New when you're on the Remotes tab)

You can use the View menu option to switch between the different script files in the editor.
Posted By: judge2020 Re: Fully working link block? - 02/04/14 06:24 PM
Originally Posted By: LostServ
Originally Posted By: judge2020

None of my other commands use aliases. So how would i go about this now?


The easiest way is to just put the link script into a new remote file. (File > New when you're on the Remotes tab)

You can use the View menu option to switch between the different script files in the editor.

seems to not be timing people out. Also no error messages come up when a link is posted. help?
Posted By: LostServ Re: Fully working link block? - 02/04/14 07:40 PM
Originally Posted By: judge2020
Originally Posted By: LostServ
Originally Posted By: judge2020

None of my other commands use aliases. So how would i go about this now?


The easiest way is to just put the link script into a new remote file. (File > New when you're on the Remotes tab)

You can use the View menu option to switch between the different script files in the editor.

seems to not be timing people out. Also no error messages come up when a link is posted. help?


Post the code you have, please. smile
Posted By: judge2020 Re: Fully working link block? - 03/04/14 10:50 AM
Originally Posted By: LostServ
Originally Posted By: judge2020
Originally Posted By: LostServ
Originally Posted By: judge2020

None of my other commands use aliases. So how would i go about this now?


The easiest way is to just put the link script into a new remote file. (File > New when you're on the Remotes tab)

You can use the View menu option to switch between the different script files in the editor.

seems to not be timing people out. Also no error messages come up when a link is posted. help?


Post the code you have, please. smile

I took your advice and put it in a different file:
Code:
on @*:text:*:#:linkpost $1- 
on @*:action:*:#:linkpost $1- 
on @*:notice:*:#:linkpost $1- 
alias -l linkpost { 
  if ((!%p) && (!$hfind(permit,$nick))) { inc -u4 %p 
    var %purge /^!(link\so(n|ff)|(permit))\b/iS 
    var %domain com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk
    var %link /(?<=^|\s)((?>\S{3,8}:\/\/|w{3}\56)\S+)|\56( $+ %domain $+ )\b/iS 
    if ($findtok(%chanon1,#,1,32)) && ($nick(#,$nick,vr)) && ($regex($1-,%link)) { 
      timeout # $nick | /mode # -b $nick 
      msg # $nick You did not have permission to post a link ask a mod to !permit you 
      msg # .timeout $nick 1
    } 
    elseif (($regex($1-,%purge)) && ($regml(1) = permit) && ($nick isop #) && ($$2 ison #)) { 
      hadd -mz permit $v1 30 | notice $v1 You have 30 seconds to post a link. Starting now! 
      msg # You now have 30 seconds to post a link!
    } 
    elseif (($regml(1) = link on) && ($nick isop #)) { 
      goto $iif(!$istok(%chanon1,#,32),a,b) | :a | set %chanon1 $addtok(%chanon,#,32) 
      .msg # My Link Protection Is Now on in: $+($chr(2),#) 
      halt | :b | .msg # $nick $+ , my link protection is already on in $& 
        $+($chr(2),#,$chr(2)) ! 
    } 
    elseif (($regml(1) = link off) && ($nick isop #)) { 
      goto $iif($istok(%chanon1,#,32),c,d) | :c | set %chanon1 $remtok(%chanon,#,1,32) 
      .msg # My Link Protection Is Now off in: $+($chr(2),#) 
      halt | :d | .msg # $nick $+ , My link protection is already off . $& 
        ! 
    } 
  } 
}

note: i changed /timeout to .timeout since that changed with a api update
Posted By: Nillen Re: Fully working link block? - 03/04/14 11:42 AM
Quote:
note: i changed /timeout to .timeout since that changed with a api update
Where did you hear this? lol.

/timeout and .timeout both work excellent. The .timeout is just so that you won't get notified of the action in your mIRC application.
Posted By: judge2020 Re: Fully working link block? - 03/04/14 12:02 PM
Originally Posted By: Nillen
Quote:
note: i changed /timeout to .timeout since that changed with a api update
Where did you hear this? lol.

/timeout and .timeout both work excellent. The .timeout is just so that you won't get notified of the action in your mIRC application.

in my recent commands /timeout didn't time the person out, and .timeout did.
Posted By: judge2020 Re: Fully working link block? - 05/04/14 06:29 PM
tried new remote file and it doesn't fix it frown
Posted By: judge2020 Re: Fully working link block? - 06/04/14 07:49 AM
This may seem like a awful way to link block, but
Code:
on *:text:*.com*:#:{
if ($read(textfile.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # Stop posting links!
}
on *:text:*www.*:#:{
if ($read(textfile.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # Stop posting links!
}

Also other on TEXT commands like http, https, info, uk, etc.

EDIT: the other script gives error LINKPOST unknown command
Posted By: bl968 Re: Fully working link block? - 15/04/14 04:29 AM
Since this looks like it is for twitch.tv

ops is a hash table with a list of all of the channel moderators.

on 1:TEXT:!permit*:#:{
if $hget(ops,$nick) == $null /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) == $null /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 $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) )
}

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) )
}
Posted By: AllDayGrinding Re: Fully working link block? - 15/04/14 04:45 PM
How do you put code in a different file? I Only put mine in the remote section. Also how do you make new files?
Posted By: AllDayGrinding Re: Fully working link block? - 15/04/14 04:47 PM
Could I just copy, paste it into mIRC or will I have to edit any?
Posted By: judge2020 Re: Fully working link block? - 15/04/14 05:00 PM
It should work if you copy and paste it.
Posted By: AllDayGrinding Re: Fully working link block? - 15/04/14 05:40 PM
Where it says %banlength Do I change "Banlength" to a number?
Posted By: bl968 Re: Fully working link block? - 16/04/14 07:12 AM
in the bot type
/set %banlength 30 for 30 seconds
/set %banlength 300 for 5 minutes
etc

In the remotes click file/new to get a new file. Then file/save as to give it a name to make it easier to track in the future than script6.mrc
Posted By: Razreaper Re: Fully working link block? - 21/04/14 08:52 PM
Most of this script works right but instead of not allowing normal users it is not allowing anyone to post even mods. Also the !permit command does not seem to be working. Is my script wrong or am i missing something else?

Code:
on 1:TEXT:!permit*:#:{
  if $hget(ops,$nick) == $null /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) == $null /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 $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. 
    /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 $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. 
    /msg $chan .timeout $nick %banlength
    /halt
  } 
  /set %Linkers $remove( %Linkers, $chr(124) $+ $$2 $+ $chr(124) )
}
Posted By: blessing Re: Fully working link block? - 21/04/14 09:33 PM
Because it uses ops hashtable to check op.

You need to change this line in entire script
Code:
if $hget(ops,$nick) == $null /halt

with
Code:
if $nick !isop # { halt }
Posted By: Razreaper Re: Fully working link block? - 21/04/14 09:50 PM
ok i changed
Code:
if $hget(ops,$nick) == $null /halt

with
Code:
if $nick !isop # { halt }


now normal users linking without permission get their links removed, get warning msg, and get timed out.

mods do NOT get their links removed but still get the warning and get timed out. Here is the new script.

Code:
on 1:TEXT:!permit*:#:{
  if $nick !isop # { 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 $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 $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. 
    /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 $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. 
    /msg $chan .timeout $nick %banlength
    /halt
  } 
  /set %Linkers $remove( %Linkers, $chr(124) $+ $$2 $+ $chr(124) )
}
Posted By: blessing Re: Fully working link block? - 21/04/14 10:10 PM
change this line in entire script
Code:
  if $hget(ops, $nick) { 
    /halt
  } 

with
Code:
if $nick isop # { halt }

Posted By: Bramzee Re: Fully working link block? - 23/04/14 01:22 AM
is it possible to set this up so that the person you permit is only able to post one link? Rather than have 30 seconds? To prevent them from posting multiple links and/or spamming them?
Posted By: bl968 Re: Fully working link block? - 23/04/14 05:08 AM
If you use my code it automatically removes the permit once a link is posted.

/set %Linkers $remove( %Linkers, $chr(124) $+ $$2 $+ $chr(124) )
© mIRC Discussion Forums