From 2ce135d5495cef1a3a3a033d31c01422789cda7e Mon Sep 17 00:00:00 2001 From: BennyThink Date: Sun, 20 Feb 2022 16:16:39 +0800 Subject: [PATCH] use quota then generate caption --- ytdlbot/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ytdlbot/tasks.py b/ytdlbot/tasks.py index 5fcabc6..a2a203e 100644 --- a/ytdlbot/tasks.py +++ b/ytdlbot/tasks.py @@ -110,14 +110,14 @@ def forward_video(url, client, bot_msg): if not res_msg: raise ValueError("Failed to forward message") obj = res_msg.document or res_msg.video or res_msg.audio - caption, _ = gen_cap(chat_id, url, obj) - res_msg.edit_text(caption, reply_markup=gen_video_markup()) if ENABLE_VIP: file_size = getattr(obj, "file_size", None) \ or getattr(obj, "file_size", None) \ or getattr(obj, "file_size", 10) # TODO: forward file size may exceed the limit vip.use_quota(chat_id, file_size) + caption, _ = gen_cap(chat_id, url, obj) + res_msg.edit_text(caption, reply_markup=gen_video_markup()) red.update_metrics("cache_hit") return True