mIRC Home    About    Download    Register    News    Help

Topic Options
#248425 - 08/10/14 09:01 AM Help with making a Twitch Bot Permit command.
Moegitto Offline
Nutrimatic drinks dispenser

Registered: 08/10/14
Posts: 9
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

Top
#248426 - 08/10/14 10:46 AM Re: Help with making a Twitch Bot Permit command. [Re: Moegitto]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
Try replace the kick line

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


- Thanks!
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#248427 - 08/10/14 10:58 AM Re: Help with making a Twitch Bot Permit command. [Re: Moegitto]
Moegitto Offline
Nutrimatic drinks dispenser

Registered: 08/10/14
Posts: 9
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?

Top
#248429 - 08/10/14 11:18 AM Re: Help with making a Twitch Bot Permit command. [Re: Moegitto]
Belhifet Offline
Fjord artisan

Registered: 26/06/14
Posts: 248
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?

Top
#248430 - 08/10/14 11:20 AM Re: Help with making a Twitch Bot Permit command. [Re: Belhifet]
Moegitto Offline
Nutrimatic drinks dispenser

Registered: 08/10/14
Posts: 9
reglist.txt

Top
#248431 - 08/10/14 11:21 AM Re: Help with making a Twitch Bot Permit command. [Re: Belhifet]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
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.
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#248432 - 08/10/14 11:40 AM Re: Help with making a Twitch Bot Permit command. [Re: westor]
Moegitto Offline
Nutrimatic drinks dispenser

Registered: 08/10/14
Posts: 9
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

Top
#248433 - 08/10/14 11:55 AM Re: Help with making a Twitch Bot Permit command. [Re: Moegitto]
Belhifet Offline
Fjord artisan

Registered: 26/06/14
Posts: 248
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.

Top
#248435 - 08/10/14 12:16 PM Re: Help with making a Twitch Bot Permit command. [Re: Moegitto]
Moegitto Offline
Nutrimatic drinks dispenser

Registered: 08/10/14
Posts: 9
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.

Top
#248437 - 08/10/14 12:35 PM Re: Help with making a Twitch Bot Permit command. [Re: Moegitto]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
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)
}
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#248439 - 08/10/14 12:54 PM Re: Help with making a Twitch Bot Permit command. [Re: westor]
Belhifet Offline
Fjord artisan

Registered: 26/06/14
Posts: 248
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?

Top
#248440 - 08/10/14 12:59 PM Re: Help with making a Twitch Bot Permit command. [Re: Belhifet]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
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
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#248449 - 08/10/14 03:46 PM Re: Help with making a Twitch Bot Permit command. [Re: Belhifet]
Moegitto Offline
Nutrimatic drinks dispenser

Registered: 08/10/14
Posts: 9
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.


Edited by Moegitto (08/10/14 03:47 PM)

Top
#248450 - 08/10/14 04:01 PM Re: Help with making a Twitch Bot Permit command. [Re: Moegitto]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
So where is the problem here?
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#248451 - 08/10/14 04:37 PM Re: Help with making a Twitch Bot Permit command. [Re: westor]
Moegitto Offline
Nutrimatic drinks dispenser

Registered: 08/10/14
Posts: 9
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.

Top
#248486 - 09/10/14 09:31 PM Re: Help with making a Twitch Bot Permit command. [Re: Moegitto]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
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.
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#248536 - 11/10/14 04:39 AM Re: Help with making a Twitch Bot Permit command. [Re: Moegitto]
Majeye Offline
Vogon poet

Registered: 21/01/14
Posts: 101
Loc: MN, USA
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
      }
    }
  }
}


Edited by Majeye (11/10/14 04:41 AM)

Top
#248537 - 11/10/14 05:30 AM Re: Help with making a Twitch Bot Permit command. [Re: Majeye]
Moegitto Offline
Nutrimatic drinks dispenser

Registered: 08/10/14
Posts: 9
This is it! Thank you so much, now I can actually say it's complete. Thank you so much.

Top
#248538 - 11/10/14 05:46 AM Re: Help with making a Twitch Bot Permit command. [Re: Majeye]
Moegitto Offline
Nutrimatic drinks dispenser

Registered: 08/10/14
Posts: 9
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.

Top
#248539 - 11/10/14 07:35 AM Re: Help with making a Twitch Bot Permit command. [Re: Moegitto]
Majeye Offline
Vogon poet

Registered: 21/01/14
Posts: 101
Loc: MN, USA
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).

Top