Пример #1
0
def handle(bot, notification):
    data = parseNotification(notification)

    print time.strftime('%Y-%m-%d %I:%M:%S', time.localtime(time.time())), 'got notification'
    ntype = data['ntype']

    if ntype in NTYPES.values():
        # 进入消息队列
        q.enqueue(reply, data)
Пример #2
0
def handle(bot, notification):
    data = parseNotification(notification)

    print time.strftime('%Y-%m-%d %I:%M:%S',
                        time.localtime(time.time())), 'got notification'
    ntype = data['ntype']

    if ntype in NTYPES.values():
        # 进入消息队列
        q.enqueue(reply, data)
Пример #3
0
def handle(bot, notification):
    data = parseNotification(notification)

    print time.strftime('%Y-%m-%d %I:%M:%S',time.localtime(time.time())), data
    ntype = data['ntype']

    if not ntype in NTYPES.values():
        return

    owner_id, doing_id = data['owner_id'], data['doing_id']

    payloads = {
      'owner_id': owner_id,
      'doing_id': doing_id
    }

    content = ''
    if ntype == NTYPES['at_in_status']:
        doing = bot.getDoingById(owner_id, doing_id)
        if doing:
            content = self_match_pattern.sub('', doing['content'].encode('utf-8'))
        else:
            return

    elif ntype == NTYPES['reply_in_status_comment']:
        reply_id = data['reply_id']
        comment = bot.getCommentById(owner_id, doing_id, reply_id)
        if comment:
            payloads.update({
                'author_id': comment['ownerId'],
                'author_name': comment['ubname'],
                'reply_id': reply_id
            })
            content = comment['replyContent']
            content_s = content.split(u'\uff1a', 1)
            if len(content_s) == 1:
                content_s = content.split(': ', 1)
            if len(content_s) == 1:
                content_s = content.split(':', 1)
            content = content_s[-1]
            print content
        else:
            return

    print ''
    # 进入消息队列
    q.enqueue(reply, payloads, content)
Пример #4
0
def handle(bot, notification):

    print time.strftime('%Y-%m-%d %I:%M:%S', time.localtime(time.time())), 'got notification'
    if int(notification['type']) in NTYPES.values():
        # 进入消息队列
        q.enqueue(reply, notification)
Пример #5
0
def handle(bot, notification):
    print(time.strftime('%Y-%m-%d %I:%M:%S', time.localtime(time.time())),
          'got notification')
    if int(notification['type']) in NTYPES.values():
        # 进入消息队列
        q.enqueue(reply, notification)