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
评论列表
文章目录