Skip to content

Commit f43f319

Browse files
committed
fix: async context
1 parent 00df387 commit f43f319

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

neonize/aioze/client.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ async def build_sticker_message(
823823
)
824824
io_save.seek(0)
825825
else:
826-
with AFFmpeg(sticker) as ffmpeg:
826+
async with AFFmpeg(sticker) as ffmpeg:
827827
animated = True
828828
sticker = await ffmpeg.cv_to_webp()
829829
io_save = BytesIO(sticker)
@@ -905,7 +905,7 @@ async def build_video_message(
905905
io = BytesIO(await get_bytes_from_name_or_url_async(file))
906906
io.seek(0)
907907
buff = io.read()
908-
with AFFmpeg(file) as ffmpeg:
908+
async with AFFmpeg(file) as ffmpeg:
909909
duration = int((await ffmpeg.extract_info()).format.duration)
910910
thumbnail = await ffmpeg.extract_thumbnail()
911911
upload = await self.upload(buff)
@@ -1070,7 +1070,7 @@ async def build_audio_message(
10701070
io.seek(0)
10711071
buff = io.read()
10721072
upload = await self.upload(buff)
1073-
with AFFmpeg(io.getvalue()) as ffmpeg:
1073+
async with AFFmpeg(io.getvalue()) as ffmpeg:
10741074
duration = int((await ffmpeg.extract_info()).format.duration)
10751075
message = Message(
10761076
audioMessage=AudioMessage(
@@ -2755,7 +2755,7 @@ def get_all_devices(self) -> List["Device"]:
27552755
return self.get_all_devices_from_db(self.database_name)
27562756

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

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

0 commit comments

Comments
 (0)