[V2 Audio] Fixes channel full error while bot is in channel (#1924)

* This fixes #1643

* put the correct type for v2

* Update audio.py

Apply this previous change to the other applicable case.

* whitespace

* fracking web-editor
This commit is contained in:
Michael H 2019-02-08 10:32:27 -05:00 committed by Kowlin
parent 81929e77a3
commit 5444da655a

View File

@ -2251,6 +2251,7 @@ class Audio:
channel = author.voice_channel channel = author.voice_channel
if channel: if channel:
in_channel = bool(server.me in channel.voice_members)
is_admin = channel.permissions_for(server.me).administrator is_admin = channel.permissions_for(server.me).administrator
if channel.user_limit == 0: if channel.user_limit == 0:
is_full = False is_full = False
@ -2259,11 +2260,11 @@ class Audio:
if channel is None: if channel is None:
raise AuthorNotConnected raise AuthorNotConnected
elif channel.permissions_for(server.me).connect is False: elif channel.permissions_for(server.me).connect is False and not in_channel:
raise UnauthorizedConnect raise UnauthorizedConnect
elif channel.permissions_for(server.me).speak is False: elif channel.permissions_for(server.me).speak is False:
raise UnauthorizedSpeak raise UnauthorizedSpeak
elif is_full and not is_admin: elif is_full and not is_admin and not in_channel:
raise ChannelUserLimit raise ChannelUserLimit
else: else:
return True return True