Skip to content

Commit

Permalink
style(pre-commit): auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Nov 27, 2024
1 parent 589fc0f commit c2dcc0d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
4 changes: 3 additions & 1 deletion discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 9 additions & 5 deletions discord/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
import os
from typing import TYPE_CHECKING

__all__ = ("File", "VoiceMessage", )
__all__ = (
"File",
"VoiceMessage",
)


class File:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
8 changes: 4 additions & 4 deletions discord/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion discord/webhook/async_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c2dcc0d

Please sign in to comment.