The whole script is made so that it sends the msg to the channel where you gave the command !viewerupdate .
Now, do you want the timer to stop when someone parts that channel ?
If so, use this code instead:
on *:text:*:#: {
if ($strip($1) == !viewerupdate) {
if ($strip($2) == $null) {
set %viewerschan $chan
msg $chan Viewer Update Has Been Started
.timer.update 0 10 sayviewers $chan zacbot661 nightbot wizebot
}
if ($strip($2) == off) {
msg $chan Viewer Update has been stopped
.timer.update off
}
}
}
alias sayviewers {
set %viewers $nick($1,0)
var %v = 1
while (%v <= $nick($1,0)) {
if ($istok($2-,$nick($1,%v),32)) {
dec %viewers 1
}
inc %v
}
JSONOpen -ud followcount https://api.twitch.tv/kraken/channels/ $+ $mid(#, 2-)
msg followers -> # $json(followcount, followers) $1 Viewers -> %viewers
}
on *:part:#: {
if ($chan == %viewerschan) {
if ($timer(.update)) {
.timer.update off
}
}
}
Example:
If you start the timer in #test , if someone parts from #test the timer will be stopped.
If someone parts #blabla the timer wont stop
