From 6188397fc9a51521a93c7b6db810b0076c2e9c22 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Mon, 24 Apr 2017 00:16:48 -0400 Subject: [PATCH] [commands] Add Context.voice_client shortcut. --- discord/ext/commands/context.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/discord/ext/commands/context.py b/discord/ext/commands/context.py index 36c2336c1..f07ab6ac7 100644 --- a/discord/ext/commands/context.py +++ b/discord/ext/commands/context.py @@ -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