diff --git a/discord/abc.py b/discord/abc.py index 4e10e1305..84a9349e6 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -55,7 +55,7 @@ from .mentions import AllowedMentions from .permissions import PermissionOverwrite, Permissions from .role import Role from .invite import Invite -from .file import File, VoiceMessageFile +from .file import File from .http import handle_message_parameters from .voice_client import VoiceClient, VoiceProtocol from .sticker import GuildSticker, StickerItem @@ -1584,6 +1584,13 @@ class Messageable: The poll to send with this message. .. versionadded:: 2.4 + voice: :class:`bool` + If the message is a voice message. + + .. warning:: + + `file` attribute must be a :class:`discord.VoiceMessageFile` for this to work. Content must also be `None` + .. versionadded:: 2.6 Raises -------- @@ -1921,31 +1928,6 @@ class Messageable: # There's no data left after this break - async def send_voice_message(self, file: VoiceMessageFile): - """|coro| - - Sends a voice message to the destination. - - Parameters - ----------- - file: :class:`~discord.VoiceMessageFile` - The voice message file to send. - - Raises - ------- - ~discord.HTTPException - Sending the voice message failed. - ~discord.Forbidden - You do not have the proper permissions to send the voice message. - - Returns - -------- - :class:`~discord.Message` - The message that was sent. - """ - - return await self.send(file=file, voice=True) - class Connectable(Protocol): """An ABC that details the common operations on a channel that can diff --git a/discord/file.py b/discord/file.py index ccac77cd0..8155e4fd1 100644 --- a/discord/file.py +++ b/discord/file.py @@ -178,14 +178,11 @@ class VoiceMessageFile(File): super().__init__(fp, filename="voice-message.ogg", spoiler=False) self.duration = duration self._waveform = waveform - self.uploaded_filename = None def to_dict(self, index: int) -> Dict[str, Any]: payload = super().to_dict(index) payload['duration_secs'] = self.duration payload['waveform'] = self.waveform - if self.uploaded_filename is not None: - payload['uploaded_filename'] = self.uploaded_filename return payload @property