Fixed "ChannelPrivate" exception on parse param "reply_to_message" (#9)

This commit is contained in:
Kroks4502 2023-11-06 19:50:04 +03:00 committed by GitHub
parent 997f1dbe7b
commit 2190ae4a49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,7 @@ import pyrogram
from pyrogram import raw, enums
from pyrogram import types
from pyrogram import utils
from pyrogram.errors import MessageIdsEmpty, PeerIdInvalid
from pyrogram.errors import MessageIdsEmpty, PeerIdInvalid, ChannelPrivate
from pyrogram.parser import utils as parser_utils, Parser
from ..object import Object
from ..update import Update
@ -1028,10 +1028,13 @@ class Message(Object, Update):
reply_to_message = client.message_cache[key]
if not reply_to_message:
try:
reply_to_message = await client.get_messages(
replies=replies - 1,
**reply_to_params
)
except ChannelPrivate:
pass
if reply_to_message and not reply_to_message.forum_topic_created:
parsed_message.reply_to_message = reply_to_message
except MessageIdsEmpty: