gpt4 book ai didi

c# - Telegram Bot 无法接收 preCheckoutQuery 更新

转载 作者:行者123 更新时间:2023-12-05 07:10:56 24 4
gpt4 key购买 nike

向用户发送 sendInvoice 后(用户正确获得此付款表格)我的机器人没有收到用于付款确认的 preCheckoutQuery。我正在尝试通过 webhook 从 Telegram Bot 接收更新(特别是 preCheckoutQuery),但是在这里:

dev.botframework.com -> 我的机器人 -> Telegram -> 健康专栏 -> 问题 -> “向您的机器人发送此消息时出错:HTTP 状态代码 BadRequest”.

此外,当我尝试在 dev.botframework.com 上为我自己的机器人设置 webhook 并检查 getWebhookInfo 时,我得到了这样的特定 url:

{"ok":true,"result":{"url":"https://telegram.botframework.com/api/telegram/XXX/XXX","has_custom_certificate":false,"pending_update_count":0,"max_connections":40}}

通过这个 webhook,我的机器人可以正确地与用户进行消息传递

一些信息如何正确接收preCheckoutQuery?

附加信息:

/getWebhookInfo 有时返回我 pending_update_count":1

库:Telegram.Bot ( https://github.com/TelegramBots/telegram.bot )

我的机器人支持 TLS 1.2:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

我的 Controller 什么也没收到

[Route("api/[controller]")]
public class UpdateController : Controller
{
private readonly IBotFrameworkHttpAdapter Adapter;
private readonly IBot Bot;

public UpdateController(IBotFrameworkHttpAdapter adapter, IBot bot)
{
Adapter = adapter;
Bot = bot;
}
[HttpPost]
public async Task<IActionResult> Post([FromBody]Update _update)
{
...
await Consts.BotClient.SendTextMessageAsync(chatId, string.Format("Update received\nP: {0} M: {1} H: {2}", a.Path, a.Method, a.Host.Value));
...
}
}

最佳答案

来自链接的 GitHub 问题:

I've just received confirmation that the Azure Bot Service does not support the Telegram payment system. If you want access to all Telegram events, you'll have to connect your bot to Telegram on your own.

这意味着如果您想让 preCheckoutQuery 工作,您的机器人不能使用 ABS 端点。

关于c# - Telegram Bot 无法接收 preCheckoutQuery 更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61026273/

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