2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-31 22:46:01 +00:00

try out fasttelethon

This commit is contained in:
Nick80835
2020-07-26 09:05:35 -04:00
parent bb8d4c9de1
commit 8291b8846c
2 changed files with 330 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ from howdoi import howdoi
from PIL import Image
from telethon.tl.types import DocumentAttributeVideo
from ubot.fixes.fast_telethon import upload_file
from ubot.micro_bot import ldr
os.environ["HOWDOI_SEARCH_ENGINE"] = "bing"
@@ -197,8 +198,9 @@ async def youtube_cmd(event):
try:
if await ldr.cache.is_cache_required(video_stream.url):
file_path = await ldr.cache.cache_file(video_stream.url, f"{event.chat_id}_{event.id}")
file_handle = await upload_file(event.client, file_path)
await event.client.send_file(event.chat, file=file_path, attributes=[
await event.client.send_file(event.chat, file=file_handle, reply_to=event, attributes=[
DocumentAttributeVideo(
duration=video.length,
w=video_stream.dimensions[0],