add Bot.owner

This commit is contained in:
iDutchy 2020-10-01 01:20:34 +02:00 committed by GitHub
parent 7af9f2af94
commit 447a6a694e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,6 +125,13 @@ class BotBase(GroupMixin):
self.help_command = DefaultHelpCommand()
else:
self.help_command = help_command
@property
def owner(self):
""":class:`discord.User`: The owner, retrieved from owner_id. In case of improper caching, this can return None"""
if not self.owner_id or self.owner_ids:
raise AttributeError('No owner_id specified or you used owner_ids. If you used owner_ids, please refer to `Bot.owners`')
return self.get_user(self.owner_id)
# internal helpers