gpt4 book ai didi

curl - Telegram sendMessage 对于某些机器人来说太慢了

转载 作者:行者123 更新时间:2023-12-04 15:50:40 35 4
gpt4 key购买 nike

我有两个 Telegram Bot ,上次我注意到,第二个机器人变慢了。

我的研究表明,sendMessage 调用对其中两个调用具有不同的时间。

curl "https://api.telegram.org/bot123456789:AAAAAAAAABBBBBBBBCCCCCCC/sendMessage?chat_id=987654321&text=HI"

这是两个不同机器人的输出:

调用第一个(快速)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload Upload Total Spent Left Speed
100 224 100 224 0 0 491 0 --:--:-- --:--:-- --:--:-- 492

调用第二个机器人(慢)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload Upload Total Spent Left Speed
100 227 100 227 0 0 43 0 0:00:05 0:00:05 --:--:-- 59

第一个 sendMessage 立即运行。

第二个带有 时间花费 = 5 秒!

它总是 2-6 秒。
有谁知道原因?

对不起我的英语不好。

最佳答案

如果您的两个机器人都托管在同一个地方,那么我们可以排除网络/路由问题。
那些 sendMessage 调用是什么类型的?群发消息?如果您尝试通过两个机器人向同一组聊天 ID 发送同一批次,请记住,对未开始与机器人聊天的用户的请求将被立即拒绝。
我过去注意到的一点是,达到 API 限制会导致这样的速度变慢,您的机器人是否受欢迎或对 API 进行了大量请求?
documentation :

When sending messages inside a particular chat, avoid sending more than one message per second.

If you're sending bulk notifications to multiple users, the API will not allow more than 30 messages per second or so (..)

(..) your bot will not be able to send more than 20 messages per minute to the same group

关于curl - Telegram sendMessage 对于某些机器人来说太慢了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50987448/

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