import time import random import datetime from wxpy import * bot = Bot(cache_path=True,console_qr=2) embed(local=None, banner='', shell='ipython') try: while True: sleepNumber = random.randint(3600 * 5, 3600 * 8) nowTime = time.strftime("%Y-%m-%d %H:%M:%S") nextTime=(datetime.datetime.now() + datetime.timedelta(seconds=sleepNumber)).strftime("%Y-%m-%d %H:%M:%S") sendStr = u'[*] {nowTime} 签到成功!\n[*] {nextTime} 重新签到!'.format(nowTime=nowTime, nextTime=nextTime) sendStr_no = u'[*] {nowTime} 签到失败!\n[*] {nextTime} 重新签到!'.format(nowTime=nowTime, nextTime=nextTime) try: bot.search('T00ls')[0].send('3') except Exception as e: bot.search('你的微信小号的名字')[0].send(sendStr_no) bot.search('你的微信小号的名字')[0].send(sendStr) print(nowTime);time.sleep(sleepNumber) except Exception as e: print(e) pass