def handle_idle2(bot, ievent): """ show how idle a channel has been """ chan = ievent.channel try: elapsed = elapsedstring(time.time() - idle.data[chan]) except KeyError: ievent.reply("nobody said anything on channel %s yet" % chan) return if elapsed: ievent.reply("channel %s is idle for %s" % (chan, elapsed)) else: ievent.reply("channel %s is not idle" % chan)
def handle_idle2(bot, ievent): """ show how idle a channel has been """ chan = ievent.channel try: elapsed = elapsedstring(time.time()-idle.data[chan]) except KeyError: ievent.reply("nobody said anything on channel %s yet" % chan) return if elapsed: ievent.reply("channel %s is idle for %s" % (chan, elapsed)) else: ievent.reply("channel %s is not idle" % chan)
def handle_age(bot, ievent): """ age <nick> .. show age of user """ global db if not db: ievent.reply("plugin isnt initialised yet") ; return try: who = ievent.args[0].lower() except IndexError: ievent.missing('<nick>') ; return userhost = getwho(bot, who) if not userhost: ievent.reply("don't know userhost of %s" % who) ; return name = bot.users.getname(userhost) if not name: ievent.reply("can't find user for %s" % userhost) ; return birthday = db.execute(""" SELECT birthday FROM birthday WHERE name = %s """, name) try: birthday = birthday[0][0] except TypeError: ievent.reply("can't find birthday data for %s" % who) ; return btime = strtotime(birthday) if btime == None: ievent.reply("can't make a date out of %s" % birthday) ; return age = int(time.time()) - int(btime) ievent.reply("age of %s is %s" % (who, elapsedstring(age, ywd=True)))
def handle_idle(bot, ievent): """ arguments: [<nick>] .. show how idle an channel/user has been """ try: who = ievent.args[0] except IndexError: handle_idle2(bot, ievent) return userhost = getwho(bot, who) if not userhost: ievent.reply("can't get userhost of %s" % who) return logging.warn("idle - userhost is %s" % userhost) try: elapsed = elapsedstring(time.time() - idle.data[userhost]) except KeyError: ievent.reply("i haven't seen %s" % who) return if elapsed: ievent.reply("%s is idle for %s" % (who, elapsed)) return else: ievent.reply("%s is not idle" % who) return
def handle_uptime(bot, ievent): """ no arguments - show uptime. """ ievent.reply("<b>uptime is %s</b>" % elapsedstring(time.time()-bot.starttime))
def handle_uptime(bot, ievent): """ no arguments - show uptime. """ #from google.appengine.api import urlfetch #logging.warn(dir(urlfetch)) ievent.reply("<b>uptime is %s</b>" % elapsedstring(time.time()-bot.starttime))
def handle_uptime(bot, ievent): """ no arguments - show uptime. """ ievent.reply("<b>uptime is %s</b>" % elapsedstring(time.time() - bot.starttime))