mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-23 00:56:05 +00:00
[commands] Add Context.voice_client shortcut.
This commit is contained in:
parent
c005ef5d44
commit
6188397fc9
@ -157,3 +157,9 @@ class Context(discord.abc.Messageable):
|
||||
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
|
||||
|
||||
@property
|
||||
def voice_client(self):
|
||||
"""Optional[:class:`VoiceClient`]: A shortcut to :attr:`Guild.voice_client`\, if applicable."""
|
||||
g = self.guild
|
||||
return g.voice_client if g else None
|
||||
|
Loading…
x
Reference in New Issue
Block a user