mIRC Homepage
Posted By: Computerwiz160 [Twitch] Help With Quote Bot - 23/12/15 03:37 AM
So I have a quote bot for my stream, it will spew a quote from the list with the !saywhat command. However, I wish to have this on a cooldown so people can't spam quotes and get the bot banned. I can't for the life of me figure out how to add a cooldown to the !saywhat command detection.

I do not however want that cooldown on the !addquote command which will add quotes as long as they are a mod.

Here is my code so far
Code:
on *:LOGON:*:{
  raw CAP REQ :twitch.tv/membership
}

on *:TEXT:*:#: {
  if ($1 == !saywhat) {
    if ($2 == $null) { msg $chan $read(Quotes.txt, n) }
    ELSE {
      var %i 1
      while (%i <= $lines(Quotes.txt)) {
        if ($2 isin $read(Quotes.txt, %i)) {
          write tempfile.tmp $read(Quotes.txt, %i)
        }
        inc %i
      }
      msg $chan $read(tempfile.tmp)
      .remove tempfile.tmp
    }
  } 
  %nicks = spyker_z_ex computerwiz160 missabirose
  var %check = $istok(%nicks,$nick,32)
  if ($1 == !addquote) { 
    if ($nick isop $chan) || (%check == $true) { 
      write Quotes.txt $+($2-)  
      msg $chan Quote Added : $+($2-) 
    }
  }
}

Posted By: nanito Re: [Twitch] Help With Quote Bot - 23/12/15 04:56 AM
This is for just 1 user making the flood.
Code:
on *:TEXT:*:#: {
  if ($1 == !saywhat) {
    if ($($+(%,flood.,$nick),2)) { return }
    set -u30 %flood. $+ $nick On


this is for the entire channel

Code:
on *:TEXT:*:#: {
  if ($1 == !saywhat) {
    if ($($+(%,flood.,$nick),2)) { return }
    set -u10 %flood On


You can combine both

Code:
on *:TEXT:*:#: {
  if ($1 == !saywhat) {
    if ($($+(%,flood.,$nick),2)) { return }
    set -u10 %flood On
    set -u30 %flood. $+ $nick On


u10 = 10 seconds
u30 = 30 seconds

I use this post to make that script.
Posted By: Computerwiz160 Re: [Twitch] Help With Quote Bot - 23/12/15 05:03 AM
So where exactly would I insert this in my code?
Posted By: splinny Re: [Twitch] Help With Quote Bot - 23/12/15 05:27 AM
Code:
if ($($+(%,flood.,$nick),2)) { return }
set -u10 %flood On

This part is wrong:
if user <SomeNick1> will write something, you will create %flood for 10 secs with "On" in it, but your IF is checking for %flood.SomeNick1. You need to check for %flood or %flood.#channelname if more then 1.
Posted By: nanito Re: [Twitch] Help With Quote Bot - 23/12/15 05:45 PM
@splinny, yep, you are right.

@Computerwiz160

this is another example of text flood protection script:
http://www.mirc.org/mishbox/protection/textflood.htm
Posted By: Computerwiz160 Re: [Twitch] Help With Quote Bot - 27/12/15 03:38 AM
Okay I see what you mean, but i dont know where to insert this into my code so it doesnt mess with anything else. Do i do it at the bottom or somewhere in the middle? Noob here :P
Posted By: nanito Re: [Twitch] Help With Quote Bot - 28/12/15 10:09 AM
below the event:

Code:
on *:TEXT:*:#: {
Posted By: Computerwiz160 Re: [Twitch] Help With Quote Bot - 02/01/16 03:59 AM
So what would the fix look like for this bit?
© mIRC Discussion Forums