diff options
| author | Rapptz <[email protected]> | 2017-04-24 00:16:48 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-04-24 00:17:04 -0400 |
| commit | 6188397fc9a51521a93c7b6db810b0076c2e9c22 (patch) | |
| tree | 933a4b3325dbd48f7586d8a69b99f4630d90258e /discord/ext/commands/context.py | |
| parent | [commands] Make when_mentioned always have both mention formats. (diff) | |
| download | discord.py-6188397fc9a51521a93c7b6db810b0076c2e9c22.tar.xz discord.py-6188397fc9a51521a93c7b6db810b0076c2e9c22.zip | |
[commands] Add Context.voice_client shortcut.
Diffstat (limited to 'discord/ext/commands/context.py')
| -rw-r--r-- | discord/ext/commands/context.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/discord/ext/commands/context.py b/discord/ext/commands/context.py index 36c2336c..f07ab6ac 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 |