Originally Posted By: NFNAlexx
Hello there I have two questions. If is possible to program your bot to be on a timer where at a certain time the bot will post something in the chat on it's own? If so I would like to put !christmas and !sleep on a timer.

Second is it possible to make a follower alert for the bot. Such as if someone follows my bot will know and say "Thanks for the follow [nick name of user who followed here] Enjoy the stream and welcome to the Knights!"



This is VERY possible. Below I have included the entire code needed to make it possible. I will explain a few parts of it so you understand it a tad better. (I'm sure there is also an easier way to code this as well)

Every timer you add must have its own timerID.. so if you look at the code below you'll see 4 unique timers all with their own ID.

This code also has an ON/OFF feature.. "!links on" will obviously turn the timed messages on, just as "!links off" will turn the timed messages off.

If you look towards the top of the code, only twitch channel moderators will be able to use the ON/OFF features. (you can change this so only the channel streamer can access the code, I'll leave that up to you on how to code that since I'm providing this entire code for you)

Now look at the random numbers after the timerIDs.. see that 300,600,900,1200? Thats the amount of time needed to pass (in seconds) before it'll post that custom message again. 300 seconds = 5 minutes. 600 seconds = 10 minutes. Etc, Etc, Etc. So you can change that to your own discretion. (Keeping in mind that if you send more than 15 messages within a 20 minute period, Twitch will add an 8 hour global ban on your bot... and this is global, so if your bot is in more than 1 channel, every channel + every message = counts towards this formula)

Here is an example:

Code:
on *:TEXT:!links on:#: {
  if ($nick !isop #) return
  msg $chan AutoLINKS is now starting.
  .timer1 0 300 msg $chan Type your first message here
  .timer2 0 600 msg $chan Type your second message here
  .timer3 0 900 msg $chan Type your third message here
  .timer4 0 1200 msg $chan Type your fourth message here }
on *:text:!links off:#: { 
  msg $chan AutoLINKS are now off.
  .timer1 off
  .timer2 off
  .timer3 off
  .timer4 off
}


Now that you have the code, you can add/subtract as many timed messages as you want, just keep in mind you need to keep each one with its own unique timerID. (.timer1, .timer2, .timer3, etc, etc)

Cheers, and happy coding!

Last edited by Majeye; 15/01/15 05:57 PM.