Example #1
0
def look(bot, event):
    coll = PlugPersistCollection()
    fns = coll.filenames(event.rest)
    for fn in fns:
        try: cbtype, todotime, channel, ctime, txt = fn.split(",", 4)
        except ValueError as ex: print ex
        bot._raw("%s - %s" % (time.ctime(float(ctime)), txt))
Example #2
0
def handle_karmagood(bot, event):
    """ arguments: none - show top karma items of a channel. """
    collection = PlugPersistCollection()
    stats = StatDict()
    objs = collection.objects(event.channel.lower())
    for name, obj in objs.iteritems():
       if not obj.data: logging.warn("%s is empty" % name) ; continue
       item = stripname(name).split("-")[-1]
       stats.upitem(item, obj.data.count)
    res = []
    for item in stats.top():
        res.append("%s - %s" % item)
    event.reply("top karma items of %s: " % event.channel, res)
Example #3
0
def handle_karmagood(bot, event):
    """ arguments: none - show top karma items of a channel. """
    collection = PlugPersistCollection()
#    event.reply('Processing karma list.')
    stats = StatDict()
    objs = collection.objects()
    for name, obj in objs.iteritems():
       if not obj.data: logging.warn("%s is empty" % name) ; continue
       item = stripname(name).split("-",2)[-1]
       if stripname(name).split("-",2)[1] == event.channel.lower()[1:]:
           stats.upitem(item, obj.data.count)
    ktop = stats.top(limit=20)
#    event.reply(str(ktop))
    res = ""
    for item in ktop:
        res += (str(item[0])+':'+str(item[1])+' ')
    event.reply('Top 20 Karma for '+event.channel+': '+ res)
Example #4
0
def handle_karmagood(bot, event):
    """ arguments: none - show top karma items of a channel. """
    collection = PlugPersistCollection()
    #    event.reply('Processing karma list.')
    stats = StatDict()
    objs = collection.objects()
    for name, obj in objs.iteritems():
        if not obj.data:
            logging.warn("%s is empty" % name)
            continue
        item = stripname(name).split("-", 2)[-1]
        if stripname(name).split("-", 2)[1] == event.channel.lower()[1:]:
            stats.upitem(item, obj.data.count)
    ktop = stats.top(limit=20)
    #    event.reply(str(ktop))
    res = ""
    for item in ktop:
        res += (str(item[0]) + ':' + str(item[1]) + ' ')
    event.reply('Top 20 Karma for ' + event.channel + ': ' + res)