'傳送圖片
Log("傳送圖片==>")
Dim now As Long
DateTime.DateFormat= "yyyyMMdd HH:mm"
now = DateTime.Now
msg = "圖片發送 " & DateTime.Date(now)
Dim m1 As Map '= CreateMap("chat_id":chat_id,"text":msg)
m1.Initialize
m1.Put("chat_id",chat_id)
m1.Put("text",msg)
m1.Put("photo","https://js.pngtree.com/web3/images/logo.png")
m1.Put("parse_mode","HTML")
'm1 = CreateMap("chat_id":chat_id,"text":msg)
Dim sb As StringBuilder
Dim lc_query As String
sb.Initialize
lc_query = ""
For i=0 To m1.Size-1
If i > 0 Then
sb.Append("&")
End If
sb.Append(m1.GetKeyAt(i) )
sb.Append("=" )
sb.Append(m1.GetValueAt(i) )
Next
lc_query = sb.ToString
url = $"https://api.telegram.org/bot${token}/sendPhoto?${lc_query}"$
Log("url= "&url)
j.Download(url)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Log(j.GetString)
Dim m1 As Map
Dim json As JSONParser
json.Initialize(j.GetString)
m1 = json.NextObject
If (m1.Get("ok"))==True Then
xui.MsgboxAsync("OK","info")
End If
End If