Skip to content

Commit

Permalink
fix: async context
Browse files Browse the repository at this point in the history
  • Loading branch information
krypton-byte committed Oct 27, 2024
1 parent 00df387 commit f43f319
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions neonize/aioze/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ async def build_sticker_message(
)
io_save.seek(0)
else:
with AFFmpeg(sticker) as ffmpeg:
async with AFFmpeg(sticker) as ffmpeg:
animated = True
sticker = await ffmpeg.cv_to_webp()
io_save = BytesIO(sticker)
Expand Down Expand Up @@ -905,7 +905,7 @@ async def build_video_message(
io = BytesIO(await get_bytes_from_name_or_url_async(file))
io.seek(0)
buff = io.read()
with AFFmpeg(file) as ffmpeg:
async with AFFmpeg(file) as ffmpeg:
duration = int((await ffmpeg.extract_info()).format.duration)
thumbnail = await ffmpeg.extract_thumbnail()
upload = await self.upload(buff)
Expand Down Expand Up @@ -1070,7 +1070,7 @@ async def build_audio_message(
io.seek(0)
buff = io.read()
upload = await self.upload(buff)
with AFFmpeg(io.getvalue()) as ffmpeg:
async with AFFmpeg(io.getvalue()) as ffmpeg:
duration = int((await ffmpeg.extract_info()).format.duration)
message = Message(
audioMessage=AudioMessage(
Expand Down Expand Up @@ -2755,7 +2755,7 @@ def get_all_devices(self) -> List["Device"]:
return self.get_all_devices_from_db(self.database_name)

def new_client(
self, jid: JID = None, uuid: str = None, props: Optional[DeviceProps] = None
self, jid: Optional[JID] = None, uuid: Optional[str] = None, props: Optional[DeviceProps] = None
) -> NewAClient:
"""
This function creates a new instance of the client. If the jid parameter is not provided, a new client will be created.
Expand All @@ -2769,7 +2769,7 @@ def new_client(
:type props: Optional[DeviceProps]
"""

if not jid and not uuid:
if jid is None and uuid is None:
# you must at least provide a uuid to make sure the client is unique
raise Exception("JID and UUID cannot be none")

Expand Down

0 comments on commit f43f319

Please sign in to comment.