5
""" do a timing of a command """
7
__copyright__ = 'this file is in the public domain'
9
from gozerbot.commands import cmnds
10
from gozerbot.examples import examples
11
from gozerbot.plugins import plugins
12
from gozerbot.plughelp import plughelp
15
plughelp.add('timer', 'do a timing of a command')
17
def handle_timer(bot, ievent):
18
""" do a timing of a command """
20
ievent.reply('<cmnd>')
22
ievent.txt = ievent.rest
23
starttime = time.time()
24
result = plugins.cmnd(bot, ievent, 60)
25
stoptime = time.time()
27
ievent.reply('no result for %s' % ievent.rest)
29
result.insert(0, "%s seconds ==>" % str(stoptime-starttime))
32
cmnds.add('timer', handle_timer, ['USER', 'WEB'], allowqueue=False)
33
examples.add('timer', 'time a command', 'timer b http')