From 447a6a694e18441a7b0a0f1639365de12c84450a Mon Sep 17 00:00:00 2001 From: iDutchy <42503862+iDutchy@users.noreply.github.com> Date: Thu, 1 Oct 2020 01:20:34 +0200 Subject: [PATCH] add Bot.owner --- discord/ext/commands/bot.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index c858ab6a..2d56c3f7 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -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