From b08cda5995bc177bf11eafe94ee6bf7a88c06272 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 20 Mar 2022 13:11:38 +0800 Subject: [PATCH] Fix a msg bug --- defs/msg.py | 2 +- plugins/track.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/defs/msg.py b/defs/msg.py index 8de0375..1a09355 100644 --- a/defs/msg.py +++ b/defs/msg.py @@ -55,7 +55,7 @@ def gen_tags(data: Module) -> str: def gen_update_msg(data: Module) -> TrackMessage: text = template.format(gen_tags(data), data.name, data.description, data.latestRelease, data.updatedAt, - data.releases[0].description.replace(r"\r\n", "\n")[:1000].strip()) + data.releases[0].description.replace(r"\r\n", "\n")[:250].strip()) url = None name = None if data.releases: diff --git a/plugins/track.py b/plugins/track.py index d7023bc..541db5d 100644 --- a/plugins/track.py +++ b/plugins/track.py @@ -3,7 +3,7 @@ from asyncio import sleep from os import remove from random import uniform -from pyrogram.errors import FloodWait, ButtonUrlInvalid +from pyrogram.errors import FloodWait, ButtonUrlInvalid, MediaCaptionTooLong from pyrogram.types import Message from ci import app, scheduler, channel_id, admin_id, sqlite @@ -67,7 +67,10 @@ async def run_every_30_minute(): traceback.print_exc() await sleep(uniform(0.5, 2.0)) data_ = sqlite.get(i.name, {"msg_link": ""}) - data_["msg_link"] = msg.link + if msg: + data_["msg_link"] = msg.link + else: + data_["msg_link"] = "https://t.me/lsposed_Modules_Updates_Tracker" sqlite[i.name] = data_ await send_to_subscribes(i) await sleep(uniform(0.5, 2.0))