Skip to content

Commit

Permalink
fix: 支持语音和视频url
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien8261 committed Feb 5, 2024
1 parent f0b786c commit 66a2d44
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions amiyabot/adapters/tencent/qqGroup/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ async def get_image(self, image: Union[str, bytes]) -> Union[str, bytes]:
return image

async def get_voice(self, voice_file: str) -> str:
if voice_file.startswith('http'):
return voice_file

voice = await silkcoder.async_encode(voice_file, ios_adaptive=True)
path, url = self.temp_filename('silk')

Expand All @@ -132,6 +135,9 @@ async def get_voice(self, voice_file: str) -> str:
return url

async def get_video(self, video_file: str) -> str:
if video_file.startswith('http'):
return video_file

path, url = self.temp_filename('mp4')
shutil.copy(video_file, path)
return url
Expand Down

0 comments on commit 66a2d44

Please sign in to comment.