mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-25 18:04:10 +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,11 +157,8 @@ 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,
|
|
||||||
sorted(
|
|
||||||
task_results,
|
|
||||||
key=lambda x: (
|
key=lambda x: (
|
||||||
x.avatar.level,
|
x.avatar.level,
|
||||||
x.avatar.rarity,
|
x.avatar.rarity,
|
||||||
@ -174,9 +171,7 @@ class AvatarListPlugin(Plugin, BasePlugin):
|
|||||||
x.avatar.friendship,
|
x.avatar.friendship,
|
||||||
),
|
),
|
||||||
reverse=True,
|
reverse=True,
|
||||||
)[:max_length],
|
)[: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