This commit is contained in:
felinae98
2021-08-01 16:15:55 +08:00
parent 4f3325d988
commit 8e86fc7f02
6 changed files with 17 additions and 11 deletions
@@ -14,16 +14,15 @@ async def check_sub_target(target_type, target):
return await platform_manager[target_type].get_target_name(target)
_platform_list = defaultdict(list)
for platform in Platform.registory:
if not platform.enabled:
for _platform in Platform.registory:
if not _platform.enabled:
continue
_platform_list[platform.platform_name].append(platform)
_platform_list[_platform.platform_name].append(_platform)
platform_manager: dict[str, Platform] = dict()
for name, platform_list in _platform_list.items():
if len(platform_list) == 1:
platform_manager[name] = platform_list[0]()
else:
platform_manager[name] = NoTargetGroup(platform_list)
platform_manager[name] = NoTargetGroup([_platform() for _platform in platform_list])
print(platform_manager)
@@ -79,7 +79,7 @@ class AkVersion(NoTargetMixin, StatusChange):
res.update(res_preanounce.json())
return res
async def compare_status(self, _, old_status, new_status):
def compare_status(self, _, old_status, new_status):
res = []
if old_status.get('preAnnounceType') == 2 and new_status.get('preAnnounceType') == 0:
res.append(Post('arknights', text='开始维护!', target_name='明日方舟更新信息'))
@@ -346,7 +346,7 @@ class NoTargetGroup(
async def fetch_new_post(self, target, users):
res = defaultdict(list)
for platform in self.platform_list:
platform_res = await platform.fetch_new_post(target, users)
platform_res = await platform.fetch_new_post(target=target, users=users)
for user, posts in platform_res:
res[user].extend(posts)
return [[key, val] for key, val in res.items()]