🐛 Fix cache error

This commit is contained in:
xtaodada 2023-05-03 20:54:26 +08:00
parent b7396a7171
commit 39d66c6b6c
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 9 additions and 9 deletions

View File

@ -6,10 +6,10 @@ __all__ = "GameCacheService"
class GameCacheService(BaseService):
def __init__(
self,
strategy_cache: GameCacheForStrategy,
material_cache: GameCacheForMaterial,
light_cone_cache: GameCacheForLightCone,
self,
strategy_cache: GameCacheForStrategy,
material_cache: GameCacheForMaterial,
light_cone_cache: GameCacheForLightCone,
):
self.strategy_cache = strategy_cache
self.material_cache = material_cache
@ -18,7 +18,7 @@ class GameCacheService(BaseService):
async def get_strategy_cache(self, character_name: str) -> str:
cache = await self.strategy_cache.get_file(character_name)
if cache is not None:
return cache
return cache.decode("utf-8")
async def set_strategy_cache(self, character_name: str, file: str) -> None:
await self.strategy_cache.set_file(character_name, file)
@ -26,7 +26,7 @@ class GameCacheService(BaseService):
async def get_material_cache(self, character_name: str) -> str:
cache = await self.material_cache.get_file(character_name)
if cache is not None:
return cache
return cache.decode("utf-8")
async def set_material_cache(self, character_name: str, file: str) -> None:
await self.material_cache.set_file(character_name, file)
@ -34,7 +34,7 @@ class GameCacheService(BaseService):
async def get_light_cone_cache(self, light_cone_name: str) -> str:
cache = await self.light_cone_cache.get_file(light_cone_name)
if cache is not None:
return cache
return cache.decode("utf-8")
async def set_light_cone_cache(self, light_cone_name: str, file: str) -> None:
await self.light_cone_cache.set_file(light_cone_name, file)

View File

@ -64,7 +64,7 @@ class Inline(Plugin):
self.characters_list.append({"name": character, "icon": datas[character]})
else:
for key, value in datas.items():
if character.startswith(key):
if character.startswith(key) or character.endswith(key):
self.characters_list.append({"name": character, "icon": value})
break
# 角色培养素材
@ -73,7 +73,7 @@ class Inline(Plugin):
self.characters_material_list.append({"name": character, "icon": datas[character]})
else:
for key, value in datas.items():
if character.startswith(key):
if character.startswith(key) or character.endswith(key):
self.characters_material_list.append({"name": character, "icon": value})
break
logger.success("Inline 模块获取角色列表成功")