core.py 文件源码

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

项目:ShiokBot 作者: kianhean 项目源码 文件源码
def monitor_promo(bot, job):
    """ Job to Send Promo Message """
    msg = promo_alert.get_new_codes_message()

    if msg is None:
        print('No new promos')
    else:
        text_bot = ['Uber poked me privately and said this :wink:',
                    'I found this promo code while I was in my ActiveWear! :stuck_out_tongue:',
                    'Quick apply the code! Later run out dont cry :sunglasses:',
                    'Breaking News Brought to you by ShiokBot!',
                   ]
        all_users = promo_alert.get_all_users()
        to_send = chunks(all_users, 10)

        for group in to_send:
            for user in group:
                try:
                    bot.sendMessage(int(user),
                                    text=emojize(random.choice(text_bot), use_aliases=True),
                                    parse_mode='HTML')
                    bot.sendMessage(int(user), text=msg, parse_mode='HTML')
                except:
                    print("Error! Sending Message to " + str(user))
            sleep(1.2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号