gpt4 book ai didi

python - 如何修复Telethon的异常BadMessageError

转载 作者:行者123 更新时间:2023-12-03 08:23:22 25 4
gpt4 key购买 nike

我正在做一个应用程序,以从Telegram channel 下载所有文件。下载时,我收到错误消息:

telethon.errors.rpcbaseerrors.BadMessageError: Message too old, and it cannot be verified 
whether the server has received a message with this msg_id or not.

有人知道怎么修这个东西吗?

最佳答案

我通过此代码测试并下载了所有文件,这很好。 (例如Fundamentos_de_Matemática_Elementar.pdf)

from telethon import TelegramClient

api_id = XXXXX
api_hash = 'a191b0c8c7d88a1c34XXXXXXXXXXXXX'
phone_number = '+98937XXXXXXXX'
######################t##########################
channel_username = 'matematicaEmPDF'
################################################

client = TelegramClient(phone_number,
api_id,
api_hash,
)

client.start(phone=phone_number)

# ---------------------------------------
msgs = client.get_messages(channel_username, limit=100)

for msg in msgs.data:
if msg.media is not None:
client.download_media(message=msg)

关于python - 如何修复Telethon的异常BadMessageError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51314925/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com