Simple Idle Part for Bots

By Epic on May 01, 2011

Simple-ish Bot idle part iv used in past bot projects, does the job for most cases needed, can change the time and the message

Just replace all the #'s with the channel you want aka staff chan if your into that sort of thing

Or change the alias staffchan return #channelhere with ur chan

All goes into a Remote file (Alt+R)
Any questions/suggestions to make it more efficient just post please :)

;The Trigger
on $*:TEXT:/^[.!@]Idle/Si:#chanhere: {
  msg $staffchan Now parting all idle channels
  idlepart
}

;The Actual script
alias idlepart {
  var %x $chan(0)
  while (%x) {
    if ($nick($chan(%x),$me).idle > 86400) {
      if (!$istok(#chan1 #chan2,$chan(%x),32)) {
        Part $chan(%x) Idle for 1 Day or more. If you believe this was a mistake please reinvite.
        msg $staffchan Parting $chan(%x) because of idle time: $duration($nick($chan(%x),$me).idle)   
      }
    }
    dec %x
  }
}

;The alias for $staffchan
alias Staffchan return #channelhere

Comments

Sign in to comment.
Epic   -  May 02, 2011

thanks jethro_ i changed it to that :)

 Respond  
Wade   -  May 01, 2011

hmm handy ;) cheers :P

 Respond  
Jethro   -  May 01, 2011

You might want to use the $duration()

$duration($nick($chan(%x),$me).idle)

so it gives you the mins and secs instead of a range of numbers. Other than that, nice job.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.