🐛 Fix parsemode bug

This commit is contained in:
xtaodada 2022-08-15 10:55:25 +08:00
parent b575e41016
commit cef96a01a6
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -4,6 +4,7 @@ from asyncio import sleep
from os import remove
from random import uniform
from pyrogram.enums import ParseMode
from pyrogram.errors import FloodWait, ButtonUrlInvalid
from pyrogram.types import Message
@ -19,11 +20,11 @@ async def send_track_msg(file, track_msg) -> Message:
return await app.send_document(channel_id, file,
caption=track_msg.text,
force_document=True,
parse_mode="html",
parse_mode=ParseMode.HTML,
reply_markup=track_msg.button)
else:
return await app.send_message(channel_id, track_msg.text,
parse_mode="html",
parse_mode=ParseMode.HTML,
reply_markup=track_msg.button)
@ -49,7 +50,7 @@ async def run_every_30_minute():
msg = await app.send_document(channel_id, file,
caption=track_msg.text,
force_document=True,
parse_mode="html", )
parse_mode=ParseMode.HTML, )
except Exception:
traceback.print_exc()
with contextlib.suppress(FileNotFoundError):
@ -65,7 +66,7 @@ async def run_every_30_minute():
msg = await send_track_msg(None, track_msg)
except ButtonUrlInvalid:
print("Send button error")
msg = await app.send_message(channel_id, track_msg.text, parse_mode="html", )
msg = await app.send_message(channel_id, track_msg.text, parse_mode=ParseMode.HTML, )
except Exception:
traceback.print_exc()
await sleep(uniform(0.5, 2.0))