mIRC Homepage

Help with making a Twitch Bot Permit command.

Posted By: Moegitto

Help with making a Twitch Bot Permit command. - 08/10/14 08:01 AM

Hello, new guy here and new to making chat bots. I have everything I need set up and working properly (Link Protection, Spam protection, greetings) but I can't find a way to permit users not on the regular list to be able to post links. This is what I have right now:

on $@*:text:*:#:{
if ($regex($1-,/(http\72\/\/|www\.).+\.(com|co|uk)/iS)) && ($nick !isop $chan) {
if (!$istok(%permit,$nick,32)) {
kick $nick $chan You dont have permission to post links in here
}
}
noop $regex($1-,/^!(del|alwayspermit|permit)\s(\S+)/iS) {
if ($regml(1) == alwayspermit) && ($nick isop $chan) {
if ($istok(%permit,$regml(2),32)) {
msg $chan $regml(2) is already on always permit list
}
else {
set %permit $addtok(%permit,$regml(2),32)
msg $chan $regml(2) You are now always permited to post links
}
}
if ($regml(1) == permit) && ($nick isop $chan) {
set %permit $addtok(%permit,$regml(2),32)
.timerunset 1 20 set %permit $remtok(%permit,$regml(2),1,32)
msg $chan $regml(2) You have 20 seconds to post a link in here
}
if ($regml(1) == del) && ($nick isop $chan) {
if ($istok(%permit,$regml(2),32)) {
set %permit $remtok(%permit,$regml(2),1,32)
msg $chan $regml(2) erased suceffully from always permit list
}
else {
msg $chan $regml(2) is not on always permit list
}
}
}
}


Is there anything anybody can help me with? I think I see some misspellings but other than that I'm lost frown
Posted By: westor

Re: Help with making a Twitch Bot Permit command. - 08/10/14 09:46 AM

Try replace the kick line

with:
Code:
kick $chan $nick You don't have permission to post links in here!


- Thanks!
Posted By: Moegitto

Re: Help with making a Twitch Bot Permit command. - 08/10/14 09:58 AM

I've replaced the kick line, and it still isn't allowing me to permit. This is strange because everything else works, the only way I've found around this is to go into the .txt file and add the names manually which is hard to do in the middle of a stream and of course my mods can't access that file.Does the permit code have to be on a separate script sheet?
Posted By: Belhifet

Re: Help with making a Twitch Bot Permit command. - 08/10/14 10:18 AM

Originally Posted By: Moegitto
I've replaced the kick line, and it still isn't allowing me to permit. This is strange because everything else works, the only way I've found around this is to go into the .txt file and add the names manually which is hard to do in the middle of a stream and of course my mods can't access that file.Does the permit code have to be on a separate script sheet?


...What text file?
Posted By: Moegitto

Re: Help with making a Twitch Bot Permit command. - 08/10/14 10:20 AM

reglist.txt
Posted By: westor

Re: Help with making a Twitch Bot Permit command. - 08/10/14 10:21 AM

This code that you gave me does not working with any .txt files, probably you have duplicate code with same command.

Try to search on the mIRC Script Editor for "reglist.txt" and paste the code here, or remove this code that you gave me and try agan to see if it is working.
Posted By: Moegitto

Re: Help with making a Twitch Bot Permit command. - 08/10/14 10:40 AM

I've removed the code and nothings changed, is there another code line I can use? I've seen different ways to do it, like:

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

But I can't get that to work either, it seems like the only command I can't get to work is permit. confused
Posted By: Belhifet

Re: Help with making a Twitch Bot Permit command. - 08/10/14 10:55 AM

At this point its pretty clear that you have multiple sections of code that are looking to !permit and delete links. That's not gonna work. You need to go through your mess of a script and do some house keeping.
Posted By: Moegitto

Re: Help with making a Twitch Bot Permit command. - 08/10/14 11:16 AM

This is all the code I have:

on *:TEXT:Hi:* { msg $chan Yo $nick FrankerZ / }
on *:TEXT:Hello:* { msg $chan Yo $nick RalpherZ / }

on *:text:*.com*:#:{
if ($read(reglist.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # No links allowed without permission Kappa b
}
on *:text:*www.*:#:{
if ($read(reglist.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # No links allowed without permission Kappa b
}
on *:text:*http*:#:{
if ($read(reglist.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # No links allowed without permission Kappa b
}
on *:text:*https*:#:{
if ($read(reglist.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # No links allowed without permission Kappa b
}
on *:text:*.info*:#:{
if ($read(reglist.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # No links allowed without permission Kappa b
}
on *:text:*.uk*:#:{
if ($read(reglist.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # No links allowed without permission Kappa b
}
on *:text:*.org*:#:{
if ($read(reglist.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # No links allowed without permission Kappa b
}
on *:text:*.us*:#:{
if ($read(reglist.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # No links allowed without permission Kappa b
}
on *:text:*.ca*:#:{
if ($read(reglist.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # No links allowed without permission Kappa b
}
on *:text:*.tv*:#:{
if ($read(reglist.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # No links allowed without permission Kappa b
}
on *:text:*.net*:#:{
if ($read(reglist.txt,nw,$nick)) return
Msg # .timeout $nick 1
Msg # No links allowed without permission Kappa b
}
on *:text:*:#:{
if ($nick isop #) return
if ( $len($1-) >= 10 ) {
if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 45 ) {
if !$istok(%caps.warned,$nick,32) {
msg $chan $nick -> Kappa not caps! [warning]
set -e %caps.warned $addtok(%caps.warned,$nick,32)
.timer 1 300 remove.warned $nick
}
else msg $chan Caps again frown | msg $chan .timeout $nick 60
}
}


^This works, no permit lines work.
Posted By: westor

Re: Help with making a Twitch Bot Permit command. - 08/10/14 11:35 AM

Well man you have too many issues so the only solution is to delete all of your old code and paste this one, if this will not work then you have not delete all of your old code correctly.

Code:
on *:TEXT:Hi:* { msg $chan Yo $nick FrankerZ / }
on *:TEXT:Hello:* { msg $chan Yo $nick RalpherZ / }

ON *:TEXT:*:#: {
  tokenize 32 $strip($1-,burci)
  if ($1 == !permit) {
    if ($nick isop #) && ($2) {
      var %rn = $read(reglist.txt,nw,$2)
      if (%rn) { msg $chan [ $+ $nick $+ ]: Error, This user is already into the list! | return }
      write reglist.txt $2
      msg # $2 has been permited to post a link for 20 seconds.
      .timer[RemovePermit_ $+ $2 $+ ] 1 20 RemovePermit # $2
    }
  }
  if ($nick isop #) { return }
  if ($len($1-) >= 10 ) {
    if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 45 ) {
      if !$istok(%caps.warned,$nick,32) {
        msg $chan $nick -> Kappa not caps! [warning]
        set -e %caps.warned $addtok(%caps.warned,$nick,32)
        .timer 1 300 remove.warned $nick
      }
      else msg $chan Caps again frown | msg $chan .timeout $nick 60
    }
  }
  if ($isurl($1-)) {
    var %rn = $read(reglist.txt,nw,$nick)
    if (!%rn) { kick $chan $nick [WARNING]: You are NOT allowed to post links here. }
  }
}

alias removepermit {
  if (!$1-) { return }
  var %rn = $read(reglist.txt,nw,$2)
  var %rnum = $readn
  if (%rn) { write -dl $+ %rnum reglist.txt }
}

alias isurl {
  var %url = /(?:ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*|irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.])|aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?/
  return $regex($1,%url)
}
Posted By: Belhifet

Re: Help with making a Twitch Bot Permit command. - 08/10/14 11:54 AM

Originally Posted By: westor
Well man you have too many issues so the only solution is to delete all of your old code and paste this one, if this will not work then you have not delete all of your old code correctly.

Code:
on *:TEXT:Hi:* { msg $chan Yo $nick FrankerZ / }
on *:TEXT:Hello:* { msg $chan Yo $nick RalpherZ / }



Since you included this in your fixed code....Does that syntax function?
Posted By: westor

Re: Help with making a Twitch Bot Permit command. - 08/10/14 11:59 AM

Try this code (FIXED):

Code:
ON *:TEXT:*:#: {
  tokenize 32 $strip($1-,burci)
  if ($1 == hi) { msg $chan Yo $nick FrankerZ $chr(47) }
  if ($1 == hello) { msg $chan Yo $nick RalpherZ $chr(47) }
  if ($1 == !permit) {
    if ($nick isop #) && ($2) {
      var %rn = $read(reglist.txt,nw,$2)
      if (%rn) { msg $chan [ $+ $nick $+ ]: Error, This user is already into the list! | return }
      write reglist.txt $2
      msg # $2 has been permited to post a link for 20 seconds.
      .timer[RemovePermit_ $+ $2 $+ ] 1 20 RemovePermit # $2
    }
  }
  if ($nick isop #) { return }
  if ($len($1-) >= 10 ) {
    if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 45 ) {
      if !$istok(%caps.warned,$nick,32) {
        msg $chan $nick -> Kappa not caps! [warning]
        set -e %caps.warned $addtok(%caps.warned,$nick,32)
        .timer 1 300 remove.warned $nick
      }
      else msg $chan Caps again frown | msg $chan .timeout $nick 60
    }
  }
  if ($isurl($1-)) {
    var %rn = $read(reglist.txt,nw,$nick)
    if (!%rn) { kick $chan $nick [WARNING]: You are NOT allowed to post links here. }
  }
}

alias removepermit {
  if (!$1-) { return }
  var %rn = $read(reglist.txt,nw,$2)
  var %rnum = $readn
  if (%rn) { write -dl $+ %rnum reglist.txt }
}

alias isurl {
  var %url = /(?:ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*|irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.])|aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?/
  return $regex($1,%url)
}


NOTE: I did not really saw these 2 on text :P
Posted By: Moegitto

Re: Help with making a Twitch Bot Permit command. - 08/10/14 02:46 PM

Sorry for falling asleep at my desk, these two codes are on a separate script by themselves and they do work:











These are my greeting, link protection, and caps protection scripts.

It's like a road block because I was almost done, I'm copying all my codes to a text file and doing what you said by starting over with the code you sent. Will reply with results.
Posted By: westor

Re: Help with making a Twitch Bot Permit command. - 08/10/14 03:01 PM

So where is the problem here?
Posted By: Moegitto

Re: Help with making a Twitch Bot Permit command. - 08/10/14 03:37 PM

I just think I found the problem, or a problem I didn't know about. I can't use codes that modify a command I think, I just tested a quote script and it will quote but it won't add a quote unless I do that manually too. So I think my question is now how do I get the IRC bot to add information, that may be why my bot will purge links but not permit someone to post a link. My folders are in the normal places, I even used you gave me earlier and the problem was still I couldn't permit.
Posted By: westor

Re: Help with making a Twitch Bot Permit command. - 09/10/14 08:31 PM

I don't know what you have done but on me is working perfect, if you follow my steps you will find the way to work for, in your screenshots the results are not a part of my code so 99% you have duplicate same code, you must first remove the old code an then put the new.
Posted By: Majeye

Re: Help with making a Twitch Bot Permit command. - 11/10/14 03:39 AM

Try this instead, 100% working in my twitch channel. The commands in my script below are exactly like the ones Nightbot uses.. so even if you happen to have both bots in your channel, it'll still work for both. Including adding regulars to your bot.

Code:
on $@*:text:*:#:{
  if ($regex($1-,/.+\.(com|co|uk|net|org|gov|tv|edu|fm)/iS)) && ($nick !isop $chan) {
    if (!$istok(%permit,$nick,32)) {
      .timerban 1 1 /msg $chan /timeout $nick 1
      msg $chan Please, $Nick Ask a mod for permission to post links!
    }
  }


  noop $regex($1-,/^!(reg del|reg add|permit)\s(\S+)/iS) { 
    if ($regml(1) == reg add) && ($nick isop $chan) {
      if ($istok(%permit,$regml(2),32)) {
        msg $chan $regml(2) is already on the regular list
      }
      else {
        set %permit $addtok(%permit,$regml(2),32)
        msg $chan $regml(2) You are now always permitted to post links
      }
    }
    if ($regml(1) == permit) && ($nick isop $chan) {
      set %permit $addtok(%permit,$regml(2),32)
      .timerunset 1 30 set %permit $remtok(%permit,$regml(2),1,32)
      msg $chan $regml(2) You have 30 seconds to post a link in here
    }
    if ($regml(1) == reg del) && ($nick isop $chan) {
      if ($istok(%permit,$regml(2),32)) {
        set %permit $remtok(%permit,$regml(2),1,32)
        msg $chan $regml(2) removed from regular list
      }
      else {
        msg $chan $regml(2) is not on regular list
      }
    }
  }
}
Posted By: Moegitto

Re: Help with making a Twitch Bot Permit command. - 11/10/14 04:30 AM

This is it! Thank you so much, now I can actually say it's complete. Thank you so much.
Posted By: Moegitto

Re: Help with making a Twitch Bot Permit command. - 11/10/14 04:46 AM

My final question so I understand the code 100% is do you know where the list or .txt file is that tells you who is on the regular list? I just like to know where all my mIRC .txt files are.
Posted By: Majeye

Re: Help with making a Twitch Bot Permit command. - 11/10/14 06:35 AM

It doesn't actually write to a file, I couldn't figure out how to work that in.. perhaps someone else can write it in.

Instead, it just saves it to your variables tab in the script editor (last tab on the right).
© 2020 mIRC Discussion Forums