This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Bot pings himself every minute, and says result in channel ?

Old posts that have not been replied to for several years.
Locked
o
odoisc

Bot pings himself every minute, and says result in channel ?

Post by odoisc »

well, the topic says it all I guess.

I tried to use those ctcp ping functions, but it wasnt really working so far. I want to use this because I set up an eggdrop on my webserver, and I want it to ping itself every minute, and then to say the amont of seconds in a chan. Then I might modify it so that when the lag is more then 10 seconds it warns me that there might be something wrong with the webserver.

so, any suggestions on how to use the tcl ping for that ?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Instead of using ping, use another message. Something like:

Code: Select all

# The channel you want the ping time announced in
set selfping_chan "#sheepsex"

if {![info exists selfping_loaded]} {
  set selfping_loaded 1
  bind msg - selfping got_selfping
  bind time - * send_selfping
}
proc got_selfping {nick uhost hand text} {
  global selfping_id selfping_chan
  set parts [split $text]
  if {[llength $parts] != 2} { return 0 }
  foreach {id start_time} $parts {}
  if {[string compare $id $selfping_id]} { return 0 }
  unset selfping_id
  set curtime [clock seconds]
  incr curtime -$start_time
  putserv "privmsg $selfping_chan :Self ping is $curtime seconds"
  return 0
}
proc send_selfping {args} {
  global botnick selfping_id
  set selfping_id [rand 100000]
  putserv "privmsg $botnick :selfping $selfping_id [clock seconds]"
  return 0
}
putlog "Loaded: selfping by stdragon"
Note -- I didn't test this.
o
odoisc

Post by odoisc »

Wonderfull :)


thanks a lot, exactly what I wanted it to do :)
Locked