예제 #1
0
파일: idle.py 프로젝트: Petraea/jsonbot
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)
예제 #2
0
파일: idle.py 프로젝트: code2u/jsb
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)
예제 #3
0
파일: birthday.py 프로젝트: Petraea/jsonbot
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)))
예제 #4
0
파일: idle.py 프로젝트: Petraea/jsonbot
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
예제 #5
0
파일: idle.py 프로젝트: code2u/jsb
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   
예제 #6
0
파일: core.py 프로젝트: NURDspace/jsonbot
def handle_uptime(bot, ievent):
    """ no arguments - show uptime. """
    ievent.reply("<b>uptime is %s</b>" % elapsedstring(time.time()-bot.starttime))
예제 #7
0
파일: core.py 프로젝트: Lujeni/old-projects
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))
예제 #8
0
파일: core.py 프로젝트: Petraea/jsonbot
def handle_uptime(bot, ievent):
    """ no arguments - show uptime. """
    ievent.reply("<b>uptime is %s</b>" %
                 elapsedstring(time.time() - bot.starttime))