send_message 没有为 pytelegrambotapi 发送消息

send_message not sending message for pytelegrambotapi

我正在尝试使用 django 和 pyTelegramBotApi 在 python 中制作一个简单的 tg 机器人,它在 /start 上回答“你好”。我已经设置了 webhook,并且 bot 正在正确获取更新,但是当涉及到 send_message 时,它只是进入低谷并且不发送任何内容。

@csrf_exempt
def update_bot(request):
    json_str = request.body.decode("UTF-8")
    update = types.Update.de_json(json_str)
    tele_bot.process_new_updates([update])
    return HttpResponse({'code': 200})


@tele_bot.message_handler(commands=['start'])
def start_message(message):
    print("sending message")
    print(tele_bot.send_message(message.chat.id, "Hello"))

并且控制台输出是

sending message
[24/Dec/2020 10:54:46] "POST /bot/imagesmanager/ HTTP/1.1" 200 4

我不确定错误是什么,因为消息没有被打印出来,但我一直在使用这个:https://api.telegram.org/{bot_id}/sendMessage 很长一段时间以来,它工作得很好。 documentation 提供了有关如何以这种形式使用 api 的非常有用的信息。

我已经解决了这个问题。我刚刚在末尾用 \n 读取了我的令牌(在 repr(token) 中找到),我知道为什么更新工作正常,但简单的条带对我的帮助已经足够了)