Raise ClientException in Member.request_to_speak

This commit is contained in:
apple502j 2022-03-07 18:10:11 +09:00 committed by GitHub
parent 7ff6850f17
commit aa6fb54e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,6 +40,7 @@ from .user import BaseUser, User, _UserTag
from .activity import create_activity, ActivityTypes from .activity import create_activity, ActivityTypes
from .permissions import Permissions from .permissions import Permissions
from .enums import Status, try_enum from .enums import Status, try_enum
from .errors import ClientException
from .colour import Colour from .colour import Colour
from .object import Object from .object import Object
@ -869,13 +870,15 @@ class Member(discord.abc.Messageable, _UserTag):
Raises Raises
------- -------
ClientException
You are not connected to a voice channel.
Forbidden Forbidden
You do not have the proper permissions to the action requested. You do not have the proper permissions to the action requested.
HTTPException HTTPException
The operation failed. The operation failed.
""" """
if self.voice is None or self.voice.channel is None: if self.voice is None or self.voice.channel is None:
raise RuntimeError('Cannot request to speak while not connected to a voice channel.') raise ClientException('Cannot request to speak while not connected to a voice channel.')
payload = { payload = {
'channel_id': self.voice.channel.id, 'channel_id': self.voice.channel.id,