Search code examples
timermessagebotsircmirc

mIRC Execute command after X lines of chat


I'm a selflearned mIRC programmer and started very recently so my experience is quite limited. Here's the problem I have:

I'm creating a chat bot for Twitch and have created besides a raffle system a timed message for promting the stream it's on every few minutes. However, I'd also like to repeat the message after X lines of chat lines sent in the chat in-case the chat is going quickly so you don't miss out on social links and stuff for new visitors.

Pseudo-code for what I want to be done:

on !startpromote
  if (broadcaster) then PromoteMessage every X amount of lines passed
  else return
end
on !stoppromote
  if (broadcaster) then PromoteMessage stop
  else return
end

Solution

  • You could have a %msgCounter variable in the variables tab and then you could use the TEXT event:

    on *:TEXT:#:{
      INC %msgCounter
      if (%msgCounter > 10) { msg $chan Promotion message. }
    }
    

    You'd have to keep track of the %msgCounter variable and reset it when it hits a certain threshold.

    Not sure what you mean by broadcaster, however if you mean IRCOp than you can use isop and do:

    if ($1 isop $chan) {
    
    } 
    

    Where $1 is the user who typed the message, isop determines if the user is an operator (or maybe broadcaster) and $chan for the IRC Channel.