Пример #1
0
    async def work(self):

        if config["Function"]["GIFTSEND"] == "False":
            return
        if config["GiftSend"]["ROOM_ID"] == "":
            Log.warning("自动送礼模块房间号未配置,已停止...")
            return

        if float(config["GiftSend"]["TIME"]) >= 0 and float(
                config["GiftSend"]["TIME"]) < 24:
            # 定时送礼模式
            self.mode = 1
        elif float(config["GiftSend"]["TIME"]) < 0:
            # 循环送礼模式
            self.mode = 2
        else:
            # 一脸懵逼模式
            Log.warning("定时送礼时间配置错误,已停止...")
            return

        while 1:
            localtime = time.localtime(time.time())
            if self.mode == 1:
                if (localtime.tm_mday != self.today and localtime.tm_hour
                        == int(config["GiftSend"]["TIME"])):
                    status = await self.SendGift()
                    if status == 2 or status == 25014:
                        self.today = localtime.tm_mday
                        # 如果定时送礼有勋章没有填完,得清空轮询,防止第二天轮到的并不是第一个勋章
                        self.index = 0
                        Log.info("本次定时送礼完成,睡眠到明天")
                        await asyncio.sleep(std235959ptm())
                    elif status == 1:
                        return
                await asyncio.sleep(60)

            elif self.mode == 2:
                # 判断是否已经到另一天
                if localtime.tm_mday != self.today:
                    self.today = localtime.tm_mday
                    self.index = 0  # 如果到了清空轮询,防止还是原来的勋章
                status = await self.SendGift()
                if status == 25014:
                    self.today = localtime.tm_mday
                    # 如果定时送礼有勋章没有填完,得清空轮询,防止第二天轮到的并不是第一个勋章
                    self.index = 0
                    Log.info("本次循环送礼完成,睡眠到明天")
                    await asyncio.sleep(std235959ptm())
                elif status == 0 or status == 2:
                    SleepTime = int(-float(config["GiftSend"]["TIME"]) * 3600)
                    Log.info("本次循环送礼完成,睡眠时间 %s s" % SleepTime)
                    await asyncio.sleep(SleepTime)
                elif status == 1:
                    return
Пример #2
0
    async def work(self):
        if config["Function"]["GIFTSEND"] == "False":
            return
        if config["GiftSend"]["ROOM_ID"] == "":
            Log.warning("自动送礼模块房间号未配置,已停止...")
            return

        while 1:
            if self.ruid == 0:
                status = await self.getRoomInfo()
                if status == 1:
                    return
                elif status == 25014:
                    self.index = 0
                    await asyncio.sleep(std235959ptm())

            url = "https://api.live.bilibili.com/gift/v2/gift/bag_list"
            data = await AsyncioCurl().request_json(
                "GET", url, headers=config["pcheaders"])

            if data["code"] != 0:
                Log.warning("背包查看失败!" + data["message"])

            if len(data["data"]["list"]) != 0:
                for each in data["data"]["list"]:
                    if each["expire_at"] >= data["data"]["time"] and each[
                            "expire_at"] <= data["data"]["time"] + int(
                                config["GiftSend"]["TIME"]):
                        await self.send(each)
                        await asyncio.sleep(3)

            await asyncio.sleep(600)
Пример #3
0
    async def work(self):
        if config["Function"]["COIN2SILVER"] == "False":
            return

        while 1:
            await self.exchange(config["Coin2Silver"]["COIN"])

            await asyncio.sleep(std235959ptm())
Пример #4
0
    async def work(self):
        if config["Function"]["SILVER2COIN"] == "False":
            return

        while 1:
            await self.exchange()

            await asyncio.sleep(std235959ptm())
Пример #5
0
    async def work(self):
        if config["Function"]["DAILYBAG"] == "False":
            return

        while 1:
            await self.web()

            await self.mobile()

            if len(self.done) >= 2:
                self.done = []
                await asyncio.sleep(std235959ptm())
            else:
                await asyncio.sleep(600)
Пример #6
0
    async def work(self):
        if config["Function"]["GROUP"] == "False":
            return

        while 1:
            groups = await self.getList()
            count = len(groups)
            for each in groups:
                count -= await self.signIn(each)

            if count == 0:
                await asyncio.sleep(std235959ptm())
            else:
                await asyncio.sleep(3600)
Пример #7
0
    async def work(self):
        if config["Function"]["CASEJUDGER"] == "False":
            return

        while 1:
            status = await self.get_case()
            if status == 25014:
                await asyncio.sleep(std235959ptm())
            elif status == 0:
                await self.jury_case()
                self.determine_action()
                await self.vote_case()
                await asyncio.sleep(3)
            else:
                await asyncio.sleep(600)
Пример #8
0
    async def work(self):
        if config["Function"]["MainDailyTask"] == "False":
            return

        while 1:
            Log.info("检查主站每日任务")
            
            #必须有房间号才能运行
            if config["MainDailyTask"]["ROOM_ID"] == "":
                Log.warning("主站任务模块up主号未配置,已停止...")
            else:
                await self.watch()
                await self.coin()
                await self.share()
            await asyncio.sleep(std235959ptm())
Пример #9
0
    async def work(self):
        if config["Function"]["TASK"] == "False":
            return

        while 1:
            Log.info("检查每日任务")
            data = await self.check()

            await self.double_watch_info(data)
            await self.sign_info(data)

            if len(self.done) >= 2:
                self.done = []
                await asyncio.sleep(std235959ptm())
            else:
                await asyncio.sleep(600)
Пример #10
0
    async def work(self):
        if config["Function"]["CAPSULE"] == "False":
            return

        while 1:
            count = await self.info()
            while count > 0:
                if count >= 100:
                    status = await self.open(100)
                elif count >= 10:
                    status = await self.open(10)
                elif count > 0:
                    status = await self.open(1)
                if not status:
                    await asyncio.sleep(600)
                else:
                    count = await self.info()
                    await asyncio.sleep(3)

            await asyncio.sleep(std235959ptm())