rendered paste bodybind notc - "knock-knock" notc:knock
bind bot - "handle_invite" bot:handle_invite
if {![info exists expired_invites]} {
array set expired_invites {}
}
proc notc:knock {nick host hand text dest} {
if {![validchan $dest]} {return 0} # notice to bot
if {![botonchan $dest]} {return 0} # shouldn't occur
if {![botisop $dest]} {return 0} # can't invite anyway
utimer [rand 10] [list invite_person $nick $host $dest]
}
# called because some bot's utimer expired before this one's
proc bot:handle_invite {from cmd text} {
set ::expired_invites([list $nick $host $chan]) 1
}
proc invite_person {nick host chan} {
# check that we haven't already expired this.
if {[info exists ${::expired_invites([list $nick $host $chan])}]} {
unset ::expired_invites([list $nick $host $chan])
return 0
}
putallbots "handle_invite $nick $host $chan" # I got this!!
puthelp "INVITE $nick $chan"
}