raiwalletbot.py 文件源码

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

项目:RaiWalletBot 作者: SergiySW 项目源码 文件源码
def broadcast(bot, update):
    info_log(update)
    bot = Bot(api_key)
    # list users from MySQL
    accounts_list = mysql_select_accounts_balances()
    # some users are bugged & stop broadcast - they deleted chat with bot. So we blacklist them
    BLACK_LIST = mysql_select_blacklist()
    for account in accounts_list:
        # if not in blacklist and has balance
        if ((account[0] not in BLACK_LIST) and (int(account[1]) > 0)):
            mysql_set_blacklist(account[0])
            print(account[0])
            push_simple(bot, account[0], update.message.text.replace('/broadcast ', ''))
            sleep(0.2)
            mysql_delete_blacklist(account[0]) # if someone deleted chat, broadcast will fail and he will remain in blacklist


# bootstrap
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号