[commands] Add Context.me property.

This commit is contained in:
Rapptz 2017-03-01 18:58:56 -05:00
parent 5ce88c8a3f
commit 98cfb53d3b

View File

@ -152,3 +152,8 @@ class Context(discord.abc.Messageable):
def author(self): def author(self):
"""Returns the author associated with this context's command. Shorthand for :attr:`Message.author`""" """Returns the author associated with this context's command. Shorthand for :attr:`Message.author`"""
return self.message.author return self.message.author
@discord.utils.cached_property
def me(self):
"""Similar to :attr:`Guild.me` except it may return the :class:`ClientUser` in private message contexts."""
return self.guild.me if self.guild is not None else self.bot.user