diff --git a/discord/abc.py b/discord/abc.py index 17c9943683..49c4420306 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -1623,7 +1623,9 @@ async def send( raise InvalidArgument("files parameter must be a list of File") if files is not None: - flags = flags + MessageFlags(is_voice_message=any(isinstance(f, VoiceMessage) for f in files)) + flags = flags + MessageFlags( + is_voice_message=any(isinstance(f, VoiceMessage) for f in files) + ) try: data = await state.http.send_files( channel.id, diff --git a/discord/file.py b/discord/file.py index 9b15bdd41f..fb0e0908dd 100644 --- a/discord/file.py +++ b/discord/file.py @@ -29,7 +29,10 @@ import os from typing import TYPE_CHECKING -__all__ = ("File", "VoiceMessage", ) +__all__ = ( + "File", + "VoiceMessage", +) class File: @@ -157,7 +160,7 @@ class VoiceMessage(File): multiple requests. Attributes - ----------- + ---------- fp: Union[:class:`os.PathLike`, :class:`io.BufferedIOBase`] A audio file-like object opened in binary mode and read mode or a filename representing a file in the hard drive to @@ -189,13 +192,14 @@ class VoiceMessage(File): "duration_secs", ) - def __init__(self, + def __init__( + self, fp: str | bytes | os.PathLike | io.BufferedIOBase, # filename: str | None = None, waveform: str = "", duration_secs: float = 0.0, - **kwargs - ): + **kwargs, + ): super().__init__(fp, **kwargs) self.waveform = waveform self.duration_secs = duration_secs diff --git a/discord/http.py b/discord/http.py index 5afc3fce21..e8f461befd 100644 --- a/discord/http.py +++ b/discord/http.py @@ -596,10 +596,10 @@ def send_multipart_helper( form.append({"name": "payload_json"}) for index, file in enumerate(files): attachment_info = { - "id": index, - "filename": file.filename, - "description": file.description, - } + "id": index, + "filename": file.filename, + "description": file.description, + } if isinstance(file, VoiceMessage): attachment_info.update( waveform=file.waveform, diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index 6bab760e91..1daa44d458 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -666,7 +666,8 @@ def handle_message_parameters( payload["username"] = username flags = MessageFlags( - suppress_embeds=suppress, ephemeral=ephemeral, + suppress_embeds=suppress, + ephemeral=ephemeral, ) if applied_tags is not MISSING: