Well you would be looking for an ON *:PING or ON *:PONG event in the script itself.
Also you mentioned bot, does this mean this is all for a bot? I have one I personally made on ym website if you are interested. Has seveal commands and user levels, autojoin, auto-identify, etc. Also ^op, ^deop, things of that nature. Might be worthwhile to check it out. >:D