ChatUtils2.py 文件源码

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

项目:TelegramBots 作者: d-qoi 项目源码 文件源码
def updateChatList(bot, job):
    logger.debug("-----------------------updatedChatList--------------------")
    logger.info("Updating the chat list")
    results = mDatabase.groups.find()
    for doc in results:
        try:
            chat = bot.getChat(chat_id = doc['_id'])
            logger.info("Chat %s (%s) responded." % (chat.title, chat.id))
            mDatabase.groups.find_one_and_update({'_id':doc['_id']},
                                           { '$set' : {'title':chat.title}})
        except TelegramError:
            logger.info("Not yet removing %s (%s) from the database, it is not responding" % (doc['title'],doc['_id']))
            #mDatabase.groups.remove({'_id':doc['_id']})

        except:
            logger.info("Other error when checking %s (%s), check networking" % (doc['title'],doc['_id']))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号