在我的电报服务中使用ruby telegram-bot-ruby时,我会收到以下错误:
Telegram::Bot::Exceptions::ResponseError: Telegram API has returned the error. (ok: "false", error_code: "409", description: "Conflict: terminated by other long poll or webhook")
我使用桌面对我的开发机器人和生产机器人进行测试。因此聊天ID似乎是相同的,但bot API是不同的。
除此
我正在用python编写一个电报机器人,在命令下,每隔几秒钟就会在我的电脑上发送一张窗口的照片给聊天。当然,我不希望聊天被垃圾照片,所以我想回去编辑第一条消息,我发送的使用edit_media。
当前,我对命令的回调函数如下所示:
def callback(update: Update, context: CallbackContext):
first = True
while True:
image = screenshot('Snake') # Gets a screenshot of the window
bytes
我需要给用户发电报通知。因此,我同样使用库。
现在,要向我创建的用户发送通知,请使用以下方法:
def send_notification(chat_id,text) :
try :
if chat_id is None or text is None :
raise Exception("Invalid parameters")
print(BOT)
BOT.send_message(chat_id=chat_id, text=text,parse_mode="HTML")
我的电报机器人在个人聊天中应答,但不在群聊中应答。我找不到问题所在。我的代码中的一段代码: @app.route('/{}'.format(TOKEN), methods=['POST'])
def respond():
# retrieve the message in JSON and then transform it to Telegram object
update = telegram.Update.de_json(request.get_json(force=True), bot)
# get the chat_id t
我对网络技术不太熟悉,我想知道是否有一种方法--使用 --让做一些简单的事情(比如,每当有人给它发送消息时,都会一次又一次地重复相同的消息),而不设置服务器。
我认为没有办法绕过它,因为我需要解析JSON对象才能让chat_id能够发送消息.但我希望这里有人知道办法。
例如:
https://api.telegram.org/bot<token>/setWebHook?url=https://api.telegram.org/bot<token>/sendMessage?text=Hello%26chat_id=<somehow get the chat_id&g