def mytask3(bot): global weibo_id_array global firstcheck_weibo wbcontent = "" gl = bot.List('group', groupid) if gl is not None: for group in gl: idcount = -1 if (firstcheck_weibo == 1): weibo_id_array = copy.copy(weibo.getidarray()) firstcheck_weibo = 0 checkwbid = copy.copy(weibo.get_5_idarray()) if (firstcheck_weibo == 0): for cardid in checkwbid: idcount += 1 if int(cardid) == 0: continue if cardid not in weibo_id_array: weibo_id_array.append(cardid) retweet = weibo.checkretweet(idcount) wbpic = weibo.checkpic(idcount) wbscheme = weibo.getscheme(idcount) if (retweet): wbcontent = "小偶像刚刚[转发]了一条微博:" + '\n' + '\n' + weibo.getretweetweibo(idcount) + '\n' wbcontent = wbcontent + '\n' + "传送门:" + wbscheme else: wbcontent = "小偶像刚刚发了一条新微博:" + '\n' + '\n' + weibo.getweibo(idcount) + '\n' if (wbpic): wbcontent = wbcontent + weibo.getpic(idcount) wbcontent = wbcontent + '\n' + "传送门:" + wbscheme bot.SendTo(group, wbcontent)
def getWeibo(delay): bot = CQHttp(api_root='http://127.0.0.1:5700/') while True: global weibo_id_array global firstcheck_weibo wbcontent = '' idcount = -1 if (firstcheck_weibo == 1): weibo_id_array = copy.copy(getidarray()) firstcheck_weibo = False checkwbid = copy.copy(get_5_idarray()) if (firstcheck_weibo == 0): for cardid in checkwbid: idcount += 1 if int(cardid) == 0: continue if cardid not in weibo_id_array: weibo_id_array.append(cardid) retweet = checkretweet(idcount) wbpic = checkpic(idcount) wbscheme = getscheme(idcount) if (retweet): wbcontent = "源源刚刚[转发]了一条微博:" + '\n' + '\n' + getretweetweibo(idcount) + '\n' wbcontent = wbcontent + '\n' + "传送门:" + wbscheme else: wbcontent = "源源刚刚发了一条新微博:" + '\n' + '\n' + getweibo(idcount) + '\n' if (wbpic): wbcontent = wbcontent + getpic(idcount) wbcontent = wbcontent + '\n' + "传送门:" + wbscheme bot.send_group_msg_async(group_id=groupid(), message=wbcontent, auto_escape=False) time.sleep(int(delay))
def mytask3(bot): global weiboid global firstcheck_weibo wbcontent = "" gl = bot.List('group', '606642799') if gl is not None: for group in gl: if (firstcheck_weibo == 1): weiboid = weibo.checkid() firstcheck_weibo = 0 checkwbid = weibo.checkid() if (weiboid != checkwbid): weiboid = checkwbid retweet = weibo.checkretweet() wbpic = weibo.checkpic() wbscheme = weibo.getscheme() if (retweet): wbcontent = "小偶像刚刚[转发]了一条微博:" + '\n' + '\n' + weibo.getretweetweibo( ) + '\n' wbcontent = wbcontent + '\n' + "传送门:" + wbscheme else: wbcontent = "小偶像刚刚发了一条新微博:" + '\n' + '\n' + weibo.getweibo( ) + '\n' if (wbpic): wbcontent = wbcontent + weibo.getpic() wbcontent = wbcontent + '\n' + "传送门:" + wbscheme bot.SendTo(group, wbcontent)
def getWeibo(): # bot = CQHttp(api_root='http://127.0.0.1:5700/') try: # INFO(printStrTime() + 'check weibo') INFO('check weibo') global weibo_id_array global firstcheck_weibo wbcontent = '' idcount = -1 if (firstcheck_weibo == 1): # INFO(printStrTime() + 'first check weibo') INFO('first check weibo') weibo_id_array = copy.copy(getidarray()) firstcheck_weibo = False checkwbid = copy.copy(get_5_idarray()) if (firstcheck_weibo == 0): for cardid in checkwbid: idcount += 1 if int(cardid) == 0: continue if cardid not in weibo_id_array: weibo_id_array.append(cardid) retweet = checkretweet(idcount) wbpic = checkpic(idcount) wbscheme = getscheme(idcount) if (retweet): wbcontent = "源源刚刚[转发]了一条微博:" + '\n' + '\n' + getretweetweibo( idcount) + '\n' wbcontent = wbcontent + '\n' + "传送门:" + wbscheme else: wbcontent = "源源刚刚发了一条新微博:" + '\n' + '\n' + getweibo( idcount) + '\n' if (wbpic): wbcontent = wbcontent + getpic(idcount) wbcontent = wbcontent + '\n' + "传送门:" + wbscheme # print(printStrTime() + wbcontent) bot.send_group_msg_async(group_id=groupid(), message=wbcontent, auto_escape=False) except Exception as e: WARN('error when getWeibo') finally: # INFO(printStrTime() + 'weibo check completed') INFO('weibo check completed')
def onQQMessage(bot, contact, member, content): if content == 'wds': bot.SendTo(contact, wds.start()) elif content == "集资": bot.SendTo(contact, wds.start()) elif content == 'wds20': bot.SendTo(contact, wds20.start()) elif content == 'rank': bot.SendTo(contact, wds20.start()) elif content == "独占": duzhan = "独占请集资" + '\n' + str(wds.start()) bot.SendTo(contact, duzhan) elif content == "想39": xiang39 = "补档请看" + '\n' + "http://t.cn/RCbRLjZ" bot.SendTo(contact, xiang39) elif content == "剁椒鱼头": duojiaoyutou = "我们都爱剁椒鱼头" bot.SendTo(contact, duojiaoyutou) elif content == "欢迎新人": welcome = "欢迎聚聚加入BEJ48-黄子璇的应援群!" + '\n' + "大家可以叫子璇宝宝叁玖 ~" + '\n' + "叁玖是一只土生土长的北京姑娘,生日是5月20日,生在2002年的金牛座。" + '\n' + "九春三秋,只为遇见你。" + '\n' + "希望你我可以相知相识~" + '\n' + '\n' + "三分钟带你领略甜甜的叁玖" + '\n' + "首演unit《爱的魔法》:http://t.cn/RolMikW" + '\n' + '\n' + "出道以来第五场公演unit《爱的魔法》:http://t.cn/RCb8QBn" + '\n' + '\n' + "第四届总决选拉票公演:http://t.cn/RCb8gzH" + '\n' + '\n' + "更多补档内容请戳b站:BEJ48-黄子璇应援会 http://t.cn/RCbRLjZ" + '\n' + '\n' + "最后也请聚聚关注下叁玖的微博与超级话题吧" + '\n' + "@BEJ48-黄子璇:http://t.cn/RCbRiAe" + '\n' + "@BEJ48-黄子璇应援会:http://t.cn/RCbRNu1" + '\n' + "#黄子璇#超级话题:http://t.cn/RCbRQg2" + '\n' + '\n' + "让我们陪着这个刚出道不久的小孩子长大,看着她成为更好的人,一起给她最好的应援吧~(鞠躬)" bot.SendTo(contact, welcome) elif content == '39微博': bot.SendTo(contact, weibo.getscheme())