📅  最后修改于: 2022-03-11 14:51:57.344000             🧑  作者: Mango
Dim time
user = CreateObject("WScript.Network").UserName
time = (FormatDateTime(Now, 2)& " "& FormatDateTime(Now, 4))
Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("C:\Users\"& user& "\Desktop\state.txt",1)
state = objFileToRead.ReadAll()
objFileToRead.Close
Set objFileToRead = Nothing
url = "" 'my discord webhook
avatar = "https://discordapp.com/assets/dd4dbc0016779df1378e7812eabaa04d.png"
req1 = ("{ \" & Chr(34) & "username\" & Chr(34) & ":\" & Chr(34) & _
"Manage bot\" & Chr(34) & ", \" & Chr(34) & "avatar_url\" & Chr(34) & _
":\" & Chr(34) & avatar)
req2 = Chr(34) & ", \" & Chr(34) & "content\" & Chr(34) & ":\" & Chr(34) & _
time & " " & user & Chr(13) + Chr(10) & state & Chr(34) & " }"
Set oHTTP = CreateObject("Microsoft.XMLHTTP")
oHTTP.Open "POST", url, False
oHTTP.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oHTTP.SetRequestHeader "Content-Length", Len(req1+req2)
oHTTP.Send req1+req2
HTTPPost = oHTTP.ResponseText
MsgBox oHTTP.ResponseText