I have a question regarding posting output/results/info into Telegram that I cannot find any relevant examples over AHK. I can only manage to produce one single sentence output without any format via the Telegram URL.
If gregster have any experience in deal these complex output to Telegram, a tip of how to achieve it will be super great!
Type 01 - Complex Table Output Format
Type 02 - Iterative Output Format with multiple lines (and formatting like Bold/Italic)
Type 03 - User Command with Icons
Telegram Bot API - How to format messages ?
Telegram Bot API - How to format messages ?
Last edited by gregster on 30 Aug 2021, 02:52, edited 1 time in total.
Reason: Topic was split from unrelated topic.
Reason: Topic was split from unrelated topic.
Re: Telegram Bot API - How to format messages ?
I'll have to look into it at the weekend.
I think I have experimented with the options, but I'll have to refresh my mind.
I think I have experimented with the options, but I'll have to refresh my mind.
Re: Telegram Bot API - How to format messages ?
Thank you so much gregster!!
Re: Telegram Bot API - How to format messages ?
This is what I managed to achieve so far, which looks pretty close to your pictures.
One thing seems clear, tables are not really supported (afaics). Probably, you'll have to count characters and use the fixed-width mode, in order to get something table-like like below and in your pictures (or upload a picture of a table instead ?!)
Also, escaping certain characters in the right way seems crucial. To do that, you'll have to arrange with both Telegram's and AHK's escape preferences.
Screenshot with the Telegram Desktop App: I assume your pictures were also taken in the Desktop App? On my mobile and in the browser app, it doesn't look as nice - especially the table is broken; the speech bubbles are just not wide enough for this table size. Generally, you can't choose any colors yourself, afaik.
Some relevant docs:
* Telegram Bot API formatting options for SendMessage(): https://core.telegram.org/bots/api#formatting-options
(In the following, as far as possible, I'll use the MarkdownV2 style, but afaics there are more ways to do this.)
* AHK continuation sections (see method #2): https://www.autohotkey.com/docs/Scripts.htm#continuation
* AHK escape sequences: https://www.autohotkey.com/docs/misc/EscapeChar.htm
* URL Encoding Reference: https://www.w3schools.com/tags/ref_urlencode.ASP (in a few cases, like the + sign, this can be helpful)
Example code which should create the messages above (well, tables might not work as intended, depending on your Telegram client):(save your script in UTF-8 with BOM encoding)
While escaping with \ seemed to work for many of the characters mentioned in the Telegram docs, it didn't work for the plus sign +. I had to resort to its url encoding %2b (plus a leading \ to escape the %).
Tables don't seem to be supported natively. The fixed-width formatting should help a lot. If your values always have the same width, it will be easier - otherwise you will to have to count characters to be able to pad the separate values for perfect alignment. There is a small padding example with Format() in the Date column of the table code above.
It looks like it doesn't matter if you use spaces or tabs (`t) for spacing, Telegram will only use spaces anyway.
This was mainly for testing. There are probably some other ways to get the same results.
Of course, one could think about writing some helper functions, especially for adding escape sequences and creating tables
Please have a look at the code and the links about escaping, and feel free to ask any question you have about it!
PS: The MessageEntity parameter of SendText() offers a few additional special entities like phone numbers, hash tags, mentions, and so on... but I haven't tried it yet.
PPS: I will split these Telegram API-related posts form the Binance API topic, and create a separate topic for it.
One thing seems clear, tables are not really supported (afaics). Probably, you'll have to count characters and use the fixed-width mode, in order to get something table-like like below and in your pictures (or upload a picture of a table instead ?!)
Also, escaping certain characters in the right way seems crucial. To do that, you'll have to arrange with both Telegram's and AHK's escape preferences.
Screenshot with the Telegram Desktop App: I assume your pictures were also taken in the Desktop App? On my mobile and in the browser app, it doesn't look as nice - especially the table is broken; the speech bubbles are just not wide enough for this table size. Generally, you can't choose any colors yourself, afaik.
Some relevant docs:
* Telegram Bot API formatting options for SendMessage(): https://core.telegram.org/bots/api#formatting-options
(In the following, as far as possible, I'll use the MarkdownV2 style, but afaics there are more ways to do this.)
* AHK continuation sections (see method #2): https://www.autohotkey.com/docs/Scripts.htm#continuation
* AHK escape sequences: https://www.autohotkey.com/docs/misc/EscapeChar.htm
* URL Encoding Reference: https://www.w3schools.com/tags/ref_urlencode.ASP (in a few cases, like the + sign, this can be helpful)
Example code which should create the messages above (well, tables might not work as intended, depending on your Telegram client):
Code: Select all
; add your credentials here:
chatid :=
botToken := ""
; different formatting options, using MarkdownV2 format
text := "
(
*bold text*
\* text with escaped characters \%2b \(\>\~\); escape character is \\ \*
_italic text_
__underline__
~strikethrough~
😁😎✔❗🔼⤴🔺☎📊📈📉
~__*_bold italic, underline and strikethrough_*__~
``inline fixed-width code``
[inline URL](http://www.example.com/)
``````
; pre-formatted fixed-width code block
MsgBox, 4, , Do you want to continue? (Press YES or NO)
IfMsgBox No
return
``````
)"
; msgbox % text
param := "chat_id=" chatid "&text=" text "&parse_mode=MarkdownV2"
str := "https://api.telegram.org/bot" botToken "/sendmessage?"
url_tovar(str, param)
; table output
text := "*`nDaily Profit over the last 7 days:*"
text .= "```````nDay" multi("`t", 9) "Profit BTC" multi("`t", 6) "Profit USD" multi("`t", 4) "Trades``````"
text .= "```````n" multi("-", 10) " " multi("-", 14) " " multi("-", 12) " " multi("-", 9) "``````"
loop 7
text .= "```````n2019-09-" Format("{:02}", 15-A_Index) " 0.00000000 BTC 0.000 USD 0 trade``````"
param := "chat_id=" chatid "&text=" text "&parse_mode=MarkdownV2" ; HTML"
url_tovar(str, param)
; iterative output
obj := [{EOS: {avail: 0.05, balance: 345.45}, IOTA: {avail: 120.3, balance: 123.789}}], text := ""
for idx, item in obj
for curr, data in item {
text .= "*" curr "*`n"
text .= "```````nAvailable: " data.avail "`n"
text .= "Balance: " data.balance "`n``````"
}
param := "chat_id=" chatid "&text=" text "&parse_mode=MarkdownV2"
url_tovar(str, param)
; add custom keyboard
keyb=
(
{"keyboard":[ ["⚽ Command1", "🎃 Command2"], ["‼ Command3", "🔼 Command4"] ], "resize_keyboard" : true }
)
param := "text=Keyboard added&chat_id=" chatID "&reply_markup=" keyb "&parse_mode=MarkdownV2"
str := "https://api.telegram.org/bot" botToken "/sendmessage?"
url_tovar(str, param)
return
; -------------------------------
Multi(char, freq) {
loop % freq
str .= char
return str
}
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
}
While escaping with \ seemed to work for many of the characters mentioned in the Telegram docs, it didn't work for the plus sign +. I had to resort to its url encoding %2b (plus a leading \ to escape the %).
Tables don't seem to be supported natively. The fixed-width formatting should help a lot. If your values always have the same width, it will be easier - otherwise you will to have to count characters to be able to pad the separate values for perfect alignment. There is a small padding example with Format() in the Date column of the table code above.
It looks like it doesn't matter if you use spaces or tabs (`t) for spacing, Telegram will only use spaces anyway.
This was mainly for testing. There are probably some other ways to get the same results.
Of course, one could think about writing some helper functions, especially for adding escape sequences and creating tables
Please have a look at the code and the links about escaping, and feel free to ask any question you have about it!
PS: The MessageEntity parameter of SendText() offers a few additional special entities like phone numbers, hash tags, mentions, and so on... but I haven't tried it yet.
PPS: I will split these Telegram API-related posts form the Binance API topic, and create a separate topic for it.
Re: Telegram Bot API - How to format messages ?
@gregster this is some good stuff for Tutorials (like send Message throw Pushbullet / Microsoft Teams API)
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
Re: Telegram Bot API - How to format messages ?
Thank you, good idea, jNizM!
I might refine it a bit more in the next days - and post an extended version. I am still experimenting, and perhaps I'll really do some helper functions.
Meanwhile, for anyone interested, some general information and discussion about the (functionally huge) Telegram Bot API (including some basic code examples) can be found here: viewtopic.php?f=76&t=42031
Re: Telegram Bot API - How to format messages ?
This is really amazing gregster!
Yes the pictures are based on Desktop Telegram.
Maybe the approach to solve this is to have one module for Desktop, one module for Smartphone for handling different formats?
Yes the pictures are based on Desktop Telegram.
Maybe the approach to solve this is to have one module for Desktop, one module for Smartphone for handling different formats?
Re: Telegram Bot API - How to format messages ?
@gregster I tried to run the code but it seems the emoji just doesn't pop up.
It can show up in my text editor (sublime):
But when I send the message to Telegram, it becomes scrambled:
I am using AHK 1.1.33.10.
Any way we can fix this?
I also try to type the Emoji directly using the Telegram Unicode table:
https://gist.github.com/naiieandrade/b7166fc879627a1295e1b67b98672770
I tried to insert the emoji in the following message to Telegram, but it also just display the message "AHK: Program Started"
But I just noticed that somehow these emoji will work on AHK forum lol... how strange!
url := "https://api.telegram.org/bot" my_token "/sendMessage?text=AHK: Program Started&chat_id=" my_chatID "&reply_markup=" keyb_startup
json_message := URLDownloadToVar(url)
keyb=
(
{"keyboard":[ [" Command1", " Command2"], [" Command3", " Command4"] ], "resize_keyboard" : true }
)
It can show up in my text editor (sublime):
But when I send the message to Telegram, it becomes scrambled:
I am using AHK 1.1.33.10.
Any way we can fix this?
I also try to type the Emoji directly using the Telegram Unicode table:
https://gist.github.com/naiieandrade/b7166fc879627a1295e1b67b98672770
I tried to insert the emoji in the following message to Telegram, but it also just display the message "AHK: Program Started"
But I just noticed that somehow these emoji will work on AHK forum lol... how strange!
url := "https://api.telegram.org/bot" my_token "/sendMessage?text=AHK: Program Started&chat_id=" my_chatID "&reply_markup=" keyb_startup
json_message := URLDownloadToVar(url)
keyb=
(
{"keyboard":[ [" Command1", " Command2"], [" Command3", " Command4"] ], "resize_keyboard" : true }
)
Re: Telegram Bot API - How to format messages ?
Did you save your script in UTF-8 with BOM encoding ?
https://www.autohotkey.com/docs/FAQ.htm#nonascii
https://www.autohotkey.com/docs/FAQ.htm#nonascii
Re: Telegram Bot API - How to format messages ?
@gregster Yes it solved the problem! Thank you gregster!
I am using sublime editor, so what I did is to define a syntax-specific setting with "default_encoding": "UTF-8 with BOM" for the ahk syntax:
I am using sublime editor, so what I did is to define a syntax-specific setting with "default_encoding": "UTF-8 with BOM" for the ahk syntax:
Code: Select all
{
// Needed for AHK emoji in Telegram to work
"default_encoding": "UTF-8 with BOM",
}
Re: Telegram Bot API - How to format messages ?
Thank you @gregster for your kind help!
I have been trying to solve the skewed table issue, and my method sort of taking a short cut.
Basically I tried to create the table and make it as an image to send to Telegram to avoid such issue. But than since my AHK skill is very limited, I resort to python for help.
Although you may need to install python on Windows, along with several packages like pandas, but I think the result is not bad?
Any comments and feedback are greatly welcome!
Result:
--------------------------
A little code added to gregster's original code:
The python code:
The Telegram sendphoto code:
I have been trying to solve the skewed table issue, and my method sort of taking a short cut.
Basically I tried to create the table and make it as an image to send to Telegram to avoid such issue. But than since my AHK skill is very limited, I resort to python for help.
Although you may need to install python on Windows, along with several packages like pandas, but I think the result is not bad?
Any comments and feedback are greatly welcome!
Result:
--------------------------
A little code added to gregster's original code:
Code: Select all
; add your credentials here:
chatid := ""
botToken := ""
; different formatting options, using MarkdownV2 format
text := "
(
*bold text*
\* text with escaped characters \%2b \(\>\~\); escape character is \\ \*
_italic text_
__underline__
~strikethrough~
😁😎✔❗🔼⤴🔺☎📊📈📉
~__*_bold italic, underline and strikethrough_*__~
``inline fixed-width code``
[inline URL](http://www.example.com/)
``````
; pre-formatted fixed-width code block
MsgBox, 4, , Do you want to continue? (Press YES or NO)
IfMsgBox No
return
``````
)"
; msgbox % text
param := "chat_id=" chatid "&text=" text "&parse_mode=MarkdownV2"
str := "https://api.telegram.org/bot" botToken "/sendmessage?"
url_tovar(str, param)
; table output
text := "*`nDaily Profit over the last 7 days:*"
text .= "```````nDay" multi("`t", 9) "Profit BTC" multi("`t", 6) "Profit USD" multi("`t", 4) "Trades``````"
text .= "```````n" multi("-", 10) " " multi("-", 14) " " multi("-", 12) " " multi("-", 9) "``````"
loop 7
text .= "```````n2019-09-" Format("{:02}", 15-A_Index) " 0.00000000 BTC 0.000 USD 0 trade``````"
param := "chat_id=" chatid "&text=" text "&parse_mode=MarkdownV2" ; HTML"
url_tovar(str, param)
; table output - png
RunWait, python.exe Table2Image.py
#Include Lib_SendPhoto.ahk
TG_SendPhoto(botToken, chatid, "mytable.png", "Trade Summary")
FileDelete, "mytable.png"
; iterative output
obj := [{EOS: {avail: 0.05, balance: 345.45}, IOTA: {avail: 120.3, balance: 123.789}}], text := ""
for idx, item in obj
for curr, data in item {
text .= "*" curr "*`n"
text .= "```````nAvailable: " data.avail "`n"
text .= "Balance: " data.balance "`n``````"
}
param := "chat_id=" chatid "&text=" text "&parse_mode=MarkdownV2"
url_tovar(str, param)
; add custom keyboard
; keyb=
; (
; {"keyboard":[ ["⚽ Command1", "🎃 Command2"], [" {U00002712} Command3", "🔼 Command4"] ], "resize_keyboard" : true }
; )
keyb=
(
{"keyboard":[ [":dress: Command1", ":x: Command2"], [":a: Command3", ":star: Command4"] ], "resize_keyboard" : true }
)
param := "text=Keyboard added&chat_id=" chatID "&reply_markup=" keyb "&parse_mode=MarkdownV2"
str := "https://api.telegram.org/bot" botToken "/sendmessage?"
url_tovar(str, param)
return
; -------------------------------
Multi(char, freq) {
loop % freq
str .= char
return str
}
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
}
; -------------------------------
Code: Select all
# ------------------------------------------------------------------------------
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import six
# Create Data:
df = pd.DataFrame()
df['Day'] = ['2019-09-14', '2019-09-13', '2019-09-12']
df['Profit BTC'] = ['0.0001 BTC', '0.0003 BTC', '-0.0001 BTC']
df['Profit USD'] = ['100 USD', '300 USD', '-100 USD']
df['Trades'] = ['1 trade', '3 trade', '21 trade']
def render_mpl_table(data, col_width=3.0, row_height=0.625, font_size=14,
header_color='#40466e', row_colors=['#f1f1f2', 'w'], edge_color='w',
bbox=[0, 0, 1, 1], header_columns=0,
ax=None, **kwargs):
if ax is None:
size = (np.array(data.shape[::-1]) + np.array([0, 1])) * np.array([col_width, row_height])
fig, ax = plt.subplots(figsize=size)
ax.axis('off')
mpl_table = ax.table(cellText=data.values, bbox=bbox, colLabels=data.columns, **kwargs)
mpl_table.auto_set_font_size(False)
mpl_table.set_fontsize(font_size)
for k, cell in six.iteritems(mpl_table._cells):
cell.set_edgecolor(edge_color)
if k[0] == 0 or k[1] < header_columns:
cell.set_text_props(weight='bold', color='w')
cell.set_facecolor(header_color)
else:
cell.set_facecolor(row_colors[k[0]%len(row_colors) ])
return ax
# Generate formatted table
render_mpl_table(df, header_columns=0, col_width=2.0)
# Save result to image:
plt.savefig('mytable.png')
# ------------------------------------------------------------------------------
Code: Select all
;----------------------------------------------------------------------------------------------------------------------------------
TG_SendPhoto(token, chatID, file, caption := "" ) ; you could add more options; compare the Telegram API docs
{
url_str := "https://api.telegram.org/bot" token "/sendPhoto?caption=" caption
objParam := { "chat_id" : chatID
, "photo" : [file] }
return UploadFormData(url_str, objParam)
}
;---------------------------------------------
UploadFormData(url_str, objParam) ; Upload multipart/form-data
{
CreateFormData(postData, hdr_ContentType, objParam)
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("POST", url_str, true)
whr.SetRequestHeader("Content-Type", hdr_ContentType)
; whr.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko") ; ???????
whr.Option(6) := False ; No auto redirect
whr.Send(postData)
whr.WaitForResponse()
json_resp := whr.ResponseText
whr := ; free COM object
return json_resp ; will return a JSON string that contains, among many other things, the file_id of the uploaded file
}
;###################################################################################################################
/*
CreateFormData - Creates "multipart/form-data" for http post
Usage: CreateFormData(ByRef retData, ByRef retHeader, objParam)
retData - (out) Data used for HTTP POST.
retHeader - (out) Content-Type header used for HTTP POST.
objParam - (in) An object defines the form parameters.
To specify files, use array as the value. Example:
objParam := { "key1": "value1"
, "upload[]": ["1.png", "2.png"] }
Requirement: BinArr.ahk -- https://gist.github.com/tmplinshi/a97d9a99b9aa5a65fd20
Version : 1.20 / 2016-6-17 - Added CreateFormData_WinInet(), which can be used for VxE's HTTPRequest().
1.10 / 2015-6-23 - Fixed a bug
1.00 / 2015-5-14
*/
; Used for WinHttp.WinHttpRequest.5.1, Msxml2.XMLHTTP ...
CreateFormData(ByRef retData, ByRef retHeader, objParam) {
New CreateFormData(retData, retHeader, objParam)
}
; Used for WinInet
CreateFormData_WinInet(ByRef retData, ByRef retHeader, objParam) {
New CreateFormData(safeArr, retHeader, objParam)
size := safeArr.MaxIndex() + 1
VarSetCapacity(retData, size, 1)
DllCall("oleaut32\SafeArrayAccessData", "ptr", ComObjValue(safeArr), "ptr*", pdata)
DllCall("RtlMoveMemory", "ptr", &retData, "ptr", pdata, "ptr", size)
DllCall("oleaut32\SafeArrayUnaccessData", "ptr", ComObjValue(safeArr))
}
Class CreateFormData {
__New(ByRef retData, ByRef retHeader, objParam) {
CRLF := "`r`n"
Boundary := this.RandomBoundary()
BoundaryLine := "------------------------------" . Boundary
; Loop input paramters
binArrs := []
For k, v in objParam
{
If IsObject(v) {
For i, FileName in v
{
str := BoundaryLine . CRLF
. "Content-Disposition: form-data; name=""" . k . """; filename=""" . FileName . """" . CRLF
. "Content-Type: " . this.MimeType(FileName) . CRLF . CRLF
binArrs.Push( BinArr_FromString(str) )
binArrs.Push( BinArr_FromFile(FileName) )
binArrs.Push( BinArr_FromString(CRLF) )
}
} Else {
str := BoundaryLine . CRLF
. "Content-Disposition: form-data; name=""" . k """" . CRLF . CRLF
. v . CRLF
binArrs.Push( BinArr_FromString(str) )
}
}
str := BoundaryLine . "--" . CRLF
binArrs.Push( BinArr_FromString(str) )
retData := BinArr_Join(binArrs*)
retHeader := "multipart/form-data; boundary=----------------------------" . Boundary
}
RandomBoundary() {
str := "0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z"
Sort, str, D| Random
str := StrReplace(str, "|")
Return SubStr(str, 1, 12)
}
MimeType(FileName) {
n := FileOpen(FileName, "r").ReadUInt()
Return (n = 0x474E5089) ? "image/png"
: (n = 0x38464947) ? "image/gif"
: (n&0xFFFF = 0x4D42 ) ? "image/bmp"
: (n&0xFFFF = 0xD8FF ) ? "image/jpeg"
: (n&0xFFFF = 0x4949 ) ? "image/tiff"
: (n&0xFFFF = 0x4D4D ) ? "image/tiff"
: "application/octet-stream"
}
}
;#############################################################################################################
; Update: 2015-6-4 - Added BinArr_ToFile()
BinArr_FromString(str) {
oADO := ComObjCreate("ADODB.Stream")
oADO.Type := 2 ; adTypeText
oADO.Mode := 3 ; adModeReadWrite
oADO.Open
oADO.Charset := "UTF-8"
oADO.WriteText(str)
oADO.Position := 0
oADO.Type := 1 ; adTypeBinary
oADO.Position := 3 ; Skip UTF-8 BOM
return oADO.Read, oADO.Close
}
BinArr_FromFile(FileName) {
oADO := ComObjCreate("ADODB.Stream")
oADO.Type := 1 ; adTypeBinary
oADO.Open
oADO.LoadFromFile(FileName)
return oADO.Read, oADO.Close
}
BinArr_Join(Arrays*) {
oADO := ComObjCreate("ADODB.Stream")
oADO.Type := 1 ; adTypeBinary
oADO.Mode := 3 ; adModeReadWrite
oADO.Open
For i, arr in Arrays
oADO.Write(arr)
oADO.Position := 0
return oADO.Read, oADO.Close
}
BinArr_ToString(BinArr, Encoding := "UTF-8") {
oADO := ComObjCreate("ADODB.Stream")
oADO.Type := 1 ; adTypeBinary
oADO.Mode := 3 ; adModeReadWrite
oADO.Open
oADO.Write(BinArr)
oADO.Position := 0
oADO.Type := 2 ; adTypeText
oADO.Charset := Encoding
return oADO.ReadText, oADO.Close
}
BinArr_ToFile(BinArr, FileName) {
oADO := ComObjCreate("ADODB.Stream")
oADO.Type := 1 ; adTypeBinary
oADO.Open
oADO.Write(BinArr)
oADO.SaveToFile(FileName, 2)
oADO.Close
}
Re: Telegram Bot API - How to format messages ?
Looks good . Also thank you for posting the Python code!rc76 wrote: ↑14 Sep 2021, 20:15I have been trying to solve the skewed table issue, and my method sort of taking a short cut.
Basically I tried to create the table and make it as an image to send to Telegram to avoid such issue. But than since my AHK skill is very limited, I resort to python for help.
Although you may need to install python on Windows, along with several packages like pandas, but I think the result is not bad?
Any comments and feedback are greatly welcome!
Uploading a picture is probably the best solution, as long as the text doesn't need to be selectable. It certainly looks more pleasant than the table with the mono-spaced font.
With AHK, I would probably have thought of creating the picture with GDI+, but I am really no expert for that .
Re: Telegram Bot API - How to format messages ?
Which ever way makes life easier is the way to go!
Re: Telegram Bot API - How to format messages ?
I have encountered a very strange error.
I added the following code into the output script, and got the following error.
But I noticed @gregster 's code also have fullstops used for decimal values of the currency balance, but no error when run gregster's code. But my code with simple 0.01 will result an error.
I added the following code into the output script, and got the following error.
Code: Select all
text := "Version: 0.01"
param := "chat_id=" chatid "&text=" text "&parse_mode=MarkdownV2" ; HTML"
json_message := url_tovar(str, param)
msgbox, %json_message%
return
Re: Telegram Bot API - How to format messages ?
Afaics, the decimal points I used were located in the ; pre-formatted fixed-width code block section, which is actually intended to be used with code snippets. I assume that's the reason.
Like I said before, you might have to deal with both AHK's and Telegram's escape requirements at the same time...
Did you solve it? I think text := "Version: 0\.01" should do it.
Re: Telegram Bot API - How to format messages ?
Yes, by adding one / in front of any "." will do the trick!
Thank you @gregster !
Thank you @gregster !