utils.py 文件源码

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

项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码
def botupdated_message(bot, job):
    """
    Defining a command to notify the user and tell them what updates have been released
    It is called at every execution ONLY if there are documents in a specific db collection
    """

    messages = list(DATABASE.messages.find())
    DATABASE.messages.remove()

    invalid_chatid = []

    for message in messages:
        for chat_id in USERS['telegramID']:
            try:
                bot.sendMessage(chat_id, parse_mode='HTML',
                                text=message['text'])
            except TelegramError:
                invalid_chatid.append(chat_id)

    for chat_id in invalid_chatid:
        USERS['telegramID'].remove(chat_id)
        unsubscribe_user(chat_id, 'telegramID')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号