带VBA的电报Bot DeleteMessage ID

时间:2019-05-07 08:49:16

标签: excel vba

我有一个小的VBA Excel代码,我每10秒钟通过某个漫游器发送一次消息,但是每次发送新消息时,我都希望删除上一条消息。

我有发送消息的代码,但是我不知道通过vba Excel删除消息的过程。

Sub SendTelegramDeleteId()

Dim objRequest As Object
Dim strChatId As String
Dim strMessage As String
Dim strPostData As String
Dim strResponse As String

 strChatId = "**********" 
 strMessage = "Last check: " & TimeValue(Now)

strPostData = "chat_id=" & strChatId & "&text=" & strMessage

 Set objRequest = CreateObject("MSXML2.XMLHTTP")
    With objRequest
  .Open "POST", "https://api.telegram.org/MYBOT/sendMessage?", False
  .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  .Send (strPostData)
   GetMessageId = .responsetext


  .Open "POST", "https://api.telegram.org/MyBOT/deleteMessage?chat_id=*********&message_id=11605", True

End With

End Sub

带有deletemessage的部分不起作用。有人可以帮忙吗?

0 个答案:

没有答案