Browse Source

Remove unncessary code

pull/10230/head
blord0 2 months ago
parent
commit
27bca43918
  1. 34
      discord/abc.py
  2. 3
      discord/file.py

34
discord/abc.py

@ -55,7 +55,7 @@ from .mentions import AllowedMentions
from .permissions import PermissionOverwrite, Permissions from .permissions import PermissionOverwrite, Permissions
from .role import Role from .role import Role
from .invite import Invite from .invite import Invite
from .file import File, VoiceMessageFile from .file import File
from .http import handle_message_parameters from .http import handle_message_parameters
from .voice_client import VoiceClient, VoiceProtocol from .voice_client import VoiceClient, VoiceProtocol
from .sticker import GuildSticker, StickerItem from .sticker import GuildSticker, StickerItem
@ -1584,6 +1584,13 @@ class Messageable:
The poll to send with this message. The poll to send with this message.
.. versionadded:: 2.4 .. 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 Raises
-------- --------
@ -1921,31 +1928,6 @@ class Messageable:
# There's no data left after this # There's no data left after this
break 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): class Connectable(Protocol):
"""An ABC that details the common operations on a channel that can """An ABC that details the common operations on a channel that can

3
discord/file.py

@ -178,14 +178,11 @@ class VoiceMessageFile(File):
super().__init__(fp, filename="voice-message.ogg", spoiler=False) super().__init__(fp, filename="voice-message.ogg", spoiler=False)
self.duration = duration self.duration = duration
self._waveform = waveform self._waveform = waveform
self.uploaded_filename = None
def to_dict(self, index: int) -> Dict[str, Any]: def to_dict(self, index: int) -> Dict[str, Any]:
payload = super().to_dict(index) payload = super().to_dict(index)
payload['duration_secs'] = self.duration payload['duration_secs'] = self.duration
payload['waveform'] = self.waveform payload['waveform'] = self.waveform
if self.uploaded_filename is not None:
payload['uploaded_filename'] = self.uploaded_filename
return payload return payload
@property @property

Loading…
Cancel
Save