首页 > 解决方案 > 通过 TelegramBot 发送消息的自动热键脚本不起作用

问题描述

嗨,我有以下脚本,用于通过电报向自己发送消息。

但是它不起作用。

chatid := "XXXXXXX" ; replace XXXXXXX with your chat_id
text := "test message"
param := "chat_id=" chatid "&text=" text
str =https api.telegram.org /botXXXXXXX/sendmessage?  Broken Link for safety ; replace XXXXXXX with your API token


;msgbox, % url_tovar(str, param) ; this is useful if you need to return data

url_tovar(str, param)

url_tovar(URL, param) { 
    WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
    WebRequest.Open("POST", URL)
    WebRequest.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
    WebRequest.Send(param)
    res := WebRequest.ResponseText
    return res
}

当我运行脚本时,我收到这两条错误消息,然后什么也没有发生。

在此处输入图像描述

标签: autohotkeytelegram-bot

解决方案


推荐阅读