Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
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))
Esempio n. 4
0
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')