FeedbackBot.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:TelegramBots 作者: d-qoi 项目源码 文件源码
def statusReceived(bot, update):
    logger.debug("Message Received")

    if update.message.new_chat_member and update.message.new_chat_member.username == bot.username:
        logger.info("Added To Chat %s (%s)" %(update.message.chat.title, update.message.chat.id))
        newGroup = dict()
        chat = update.message.chat
        #newGroup['_id'] = chat.id
        newGroup['title'] = chat.title
        newGroup['admins'] = [chatmember.user.id for chatmember in chat.get_administrators()]
        logger.debug("newGroup: %s" % newGroup)

        MDB.groups.update({'_id':chat.id}, newGroup, upsert=True)
        logger.info("Added %s to the group list" % update.message.chat.title)

    elif update.message.new_chat_member:
        updateGroupData(update)
        logger.info("New member joined the chat.")
        update.message.reply_text(WELCOMETEXT, quote=False)

    elif update.message.left_chat_member and update.message.left_chat_member.username == bot.username:
        MDB.groups.remove({'_id':update.message.chat.id})
        logger.info("Removing entry for %s" % (update.message.chat.title))

# When a user sends a message, it is forwarded to everyone with this method.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号