Add try_user, owner and owners to Client #7

Merged
paris-ci merged 7 commits from try_user into 2.0 2021-09-02 19:24:52 +00:00
Showing only changes of commit 4552909eb5 - Show all commits

View File

@@ -365,16 +365,20 @@ class BotBase(GroupMixin):
"""
if self.owner_id:
owner = await self.try_user(self.owner_id)
if owner:
return [owner]
else:
return []
elif self.owner_ids:
owners = []
for owner_id in self.owner_ids:
owner = await self.try_user(owner_id)
if owner:
owners.append(owner)
return owners
else:
# We didn't have owners cached yet, cache them and retry.