最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

asynchronous - Security error while unpacking a received message: Server replied with a wrong session ID (see FAQ for details) -

programmeradmin0浏览0评论

i was trying to solve this problem in telethon from a few days , when i run this code @client.on(events.NewMessage(chats=channel_to_listen())) async def all_messages_handler(event): run(event.raw_text) return 0 client.start() it work but after a while , it print a lot of this line because the client wait for the result of the fucntion , and there is a new message to handle , so the creation of wrong session ID

Security error while unpacking a received message: Server replied with a wrong session ID (see FAQ for details)

and the solution is to run it whith async loops as you see in this example

import asyncio
@client.on(events.NewMessage(chats=channel_to_listen()))
async def all_messages_handler(event):
    
    # Create task to run the function in background
    loop = asyncio.get_event_loop()
    # Just create the task directly from run_in_executor
    loop.run_in_executor(None, run, event.raw_text)

have a good day.

making the telethon client run smoothly without blockage, and i get a lot of this message Security error while unpacking a received message: Server replied with a wrong session ID (see FAQ for details) so i fix it using async

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论