mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-22 07:07:46 +00:00
🐛 Fix avatar_list
: AttributeError: 'NoneType' object has no attribute 'avatar'
The list of `Character` may contain `None`
This commit is contained in:
parent
af529a642f
commit
b0300134cb
@ -157,26 +157,21 @@ class AvatarListPlugin(Plugin, BasePlugin):
|
|||||||
|
|
||||||
task_results = await asyncio.gather(*[_task(character) for character in characters])
|
task_results = await asyncio.gather(*[_task(character) for character in characters])
|
||||||
|
|
||||||
return list(
|
return sorted(
|
||||||
filter(
|
list(filter(lambda x: x, task_results)),
|
||||||
lambda x: x,
|
key=lambda x: (
|
||||||
sorted(
|
x.avatar.level,
|
||||||
task_results,
|
x.avatar.rarity,
|
||||||
key=lambda x: (
|
x.sum_of_skills(),
|
||||||
x.avatar.level,
|
x.avatar.constellation,
|
||||||
x.avatar.rarity,
|
# TODO 如果加入武器排序条件,需要把武器转化为图片url的处理后置
|
||||||
x.sum_of_skills(),
|
# x.weapon.level,
|
||||||
x.avatar.constellation,
|
# x.weapon.rarity,
|
||||||
# TODO 如果加入武器排序条件,需要把武器转化为图片url的处理后置
|
# x.weapon.refinement,
|
||||||
# x.weapon.level,
|
x.avatar.friendship,
|
||||||
# x.weapon.rarity,
|
),
|
||||||
# x.weapon.refinement,
|
reverse=True,
|
||||||
x.avatar.friendship,
|
)[:max_length]
|
||||||
),
|
|
||||||
reverse=True,
|
|
||||||
)[:max_length],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
async def get_final_data(self, client: Client, characters: Sequence[Character], update: Update):
|
async def get_final_data(self, client: Client, characters: Sequence[Character], update: Update):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user