It's not that hard, I take it you want this on your bot:

Code:
on *:TEXT:!Idle:#: {
  if ($nick == YOURNICKHERE) { check.idle $chan $nick }
}

This will make the bot trigger on "!Idle" on any channel it's on.
The next is the actual alias / work:
Code:
alias check.idle {
  var %m = $nick($1,0,o)
  var %i = 1
  while (%i <= %m) {
    if ($nick($1,%i,o).idle > 18000) { 
      if ($me isop $1) { mode $1 -o $ $nick($1,%i,o) }
      else { .notice $2 $nick($1,%i,o) on $1 is idle more than 5 hours! }
    }
    inc %i
  }
}

So, 18000sec = 5hours, when any op is idle for longer than 5hours it will try to deop him. If the bot isn't opped, it will notice you.

This can also work when typing "/check.idle #CHANNEL OWNNICK"
if put in own remote script