Skip to content

Commit

Permalink
fix: unsubscribe_all MessageTooLongError(close #79)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hootrix authored Nov 19, 2023
1 parent 3b999b5 commit d589fe3
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 52 deletions.
99 changes: 49 additions & 50 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ docker run -it --name keyword_alert_bot -v $(pwd)/config.yml:/app/config.yml y

- 查看日志发现个别群组无法接收消息,而软件客户端正常接收

请尝试更新telethon解决问题🤔,我也很无助。
🤔尝试更新telethon到最新版本或者稳定的1.24.0版本

- 订阅群组消息,机器人没任何反应
https://github.com/Hootrix/keyword_alert_bot/issues/20
Expand Down
6 changes: 5 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,11 @@ async def unsubscribe_all(event):
re_update = utils.db.user_subscribe_list.update(status = 1 ).where(utils.User_subscribe_list.user_id == user_id)#更新状态
re_update = re_update.execute()# 更新成功返回1,不管是否重复执行
if re_update:
await event.respond('success unsubscribe_all:\n' + msg,link_preview = False,parse_mode = None)
# await event.respond('success unsubscribe_all:\n' + msg,link_preview = False,parse_mode = None)
text, entities = html.parse('success unsubscribe_all:\n' + msg)# 解析超大文本 分批次发送 避免输出报错
for text, entities in telethon_utils.split_text(text, entities):
await event.respond(text,formatting_entities=entities)

else:
await event.respond('not found unsubscribe list')
raise events.StopPropagation
Expand Down

0 comments on commit d589fe3

Please sign in to comment.