如何检测用户是否删除了 Telegram Bot 聊天? [英] How can I detect whether a user deletes the Telegram Bot chat?

查看:151
本文介绍了如何检测用户是否删除了 Telegram Bot 聊天?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过 API 检查是否有人删除了 Telegram 中的 Bot Chat?

我的测试:目前如果用户删除聊天,新消息不会停止发送给用户.

解决方案

不.只有在向用户发送内容时才会出错.

如果用户阻止聊天,即使调用 sendChatAction 方法也不会返回错误:

<前>$ curl https://api.telegram.org/bot***/sendChatAction -d 'chat_id=7975895' -d "action=typing"{确定":真,结果":真}

<前>$ curl https://api.telegram.org/bot***/sendMessage -d 'chat_id=81083738' -d "text=ololo"{"ok":false,"error_code":403,"description":"[错误]:机器人被用户阻止了"}

Is it possible to check, via an API, whether somebody has deleted the Bot Chat in Telegram?

My test : Currently if a user deletes a chat, new messages will not stop sending to user.

解决方案

Nope. Only by getting error while sending user something.

Even calling sendChatAction method does not return error if user blocked the chat:

$ curl https://api.telegram.org/bot***/sendChatAction -d 'chat_id=7975895' -d "action=typing"
{"ok":true,"result":true}

$ curl https://api.telegram.org/bot***/sendMessage -d 'chat_id=81083738' -d "text=ololo"
{"ok":false,"error_code":403,"description":"[Error]: Bot was blocked by the user"}

这篇关于如何检测用户是否删除了 Telegram Bot 聊天?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆