RTFC Posted January 12, 2017 Share Posted January 12, 2017 On 05/01/2017 at 11:49 PM, LinkOut said: it's 100% safe and secure, Curl may be, but Telegram itself is not. Using it for secure communications without two-factor authentication leaves a security hole you can drive a truck through, see for example here, here, here, and here. My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
TheDcoder Posted January 12, 2017 Share Posted January 12, 2017 I created an issue at your repository Quote "AutoIT" used instead of "AutoIt" The correct capitalisation is AutoIt (pronounced Aww - Toe - It). Not Auto - I.T 😜 user4157124 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
LinkOut Posted January 13, 2017 Author Share Posted January 13, 2017 On 12/1/2017 at 8:18 AM, bambus1980 said: its cool, but, what about using proxy server, ntlm proxy? if I use curl it will be: curl -s -k -U : --proxy-ntlm --proxy server:port https://google.com -o index.htm how make that UDF working with proxy? If you want to use proxy with cURL, download the older version of the UDF and add your commands to the $query that start curl with arguments. On 12/1/2017 at 10:14 AM, RTFC said: Curl may be, but Telegram itself is not. Using it for secure communications without two-factor authentication leaves a security hole you can drive a truck through, see for example here, here, here, and here. I think that if you use THIS udf for secure communications... it's not the right thing. On 12/1/2017 at 11:32 AM, TheDcoder said: I created an issue at your repository I saw! Thanks Link to comment Share on other sites More sharing options...
mintea Posted February 16, 2017 Share Posted February 16, 2017 Many thanks for your script, I am seeking for this for a long time other than python one. I had a few issues and not sure is it should related to this UDF and ask here. 1. Proxy issue also, it can't detect my computer setting for the proxy set inside IE. 2. How to convert the non english text received as unicode code point to readable string e.g. \u5514\u7dca\u8981 ? 3. How to send emoji using sendmessage? Link to comment Share on other sites More sharing options...
LinkOut Posted February 21, 2017 Author Share Posted February 21, 2017 On 16/2/2017 at 9:30 AM, mintea said: Many thanks for your script, I am seeking for this for a long time other than python one. I had a few issues and not sure is it should related to this UDF and ask here. 1. Proxy issue also, it can't detect my computer setting for the proxy set inside IE. 2. How to convert the non english text received as unicode code point to readable string e.g. \u5514\u7dca\u8981 ? 3. How to send emoji using sendmessage? 1. I don't really know how to use a proxy with the WinHttp udf that the script use. You can search for a different library that allow direct connection between a proxy, and use this to send http request to Telegram server; 2. \u5514\u7dca\u8981 <- this is the Unicode of an Emoji. You canconvert this to another encoding format but... 3. You can find ready-made UDFs that manage Emoji and can convert encoding to another and send them to Telegram. Or, better, SciTE (or Notepad++) support UTF-8 encoding and you can just copy emojis from telegram or emojipedia and paste directly into source code, and done! Link to comment Share on other sites More sharing options...
sakamoto Posted March 3, 2017 Share Posted March 3, 2017 Thanks a lot for UDF. Someone else can give an example of inline_keyboard? Marcelos 1 Link to comment Share on other sites More sharing options...
LinkOut Posted March 6, 2017 Author Share Posted March 6, 2017 On 4/3/2017 at 0:55 AM, sakamoto said: Thanks a lot for UDF. Someone else can give an example of inline_keyboard? Thank you for using it! To use inline_keyboard first you have to create an array of array of button (sound bad, I know) and then add this (encoded in json format) to the query. I'm working on it but only in php for the moment. If this can help you: $keyboard = array("inline_keyboard" => array(array(array("text" => "ButtonText", "callback_data" => "CallbackText"),array("text" => "ButtonText2", "callback_data" => "CallbackText2")))); $keyboard = json_encode($keyboard, true); And after send it as: http://api.telegram.org/bot<TOKEN>/sendMessage?chat_id=12345678&text=test&reply_markup=$keyboard Marcelos 1 Link to comment Share on other sites More sharing options...
sakamoto Posted March 6, 2017 Share Posted March 6, 2017 (edited) LinkOut, thanks for the answer. I figured out the buttons, but get an error when receiving callback_data. Other methods "url" "switch_inline_query" work out well. #include "Telegram UDF.au3" $ikeyb = '{"inline_keyboard":[[{"text":"Button 1","callback_data":"data 1"}]]}' _InitBot("xxxIDxxx","xxxTOKENxxx") While 1 $msgData = _Polling() If $msgData <> '' Then ConsoleWrite($msgData[0]&'|'&$msgData[1]&'|'&$msgData[2]&'|'&$msgData[3]&@LF) Switch $msgData[3] Case '777' _SendMsg($msgData[2], 'Message', Default, $ikeyb) EndSwitch WEnd Telegram UDF.au3" (481) $dataArray[2] = $tmpChatID[3] $dataArray[2] = ^ ERROR Edited March 6, 2017 by sakamoto Marcelos 1 Link to comment Share on other sites More sharing options...
sakamoto Posted March 9, 2017 Share Posted March 9, 2017 (edited) My post above are no longer relevant. I modified _JSONDecode function to return more variables: $msgData[4] = Callback query ID $msgData[5] = Callback data $msgData[6] = MessageID And add new functions to respond to callback query: _answerCallbackQuery($ChatID, $Text, $Alert = True, $Cache_time = '5') _editMessageReplyMarkup($ChatID, $message_id, $reply_markup) _editMessageText($ChatID, $message_id, $Text, $reply_markup) This for my bot is still enough. expandcollapse popupFunc _JSONDecode($JSONMsg) Local $firstSplit = StringSplit($JSONMsg,"update_id",1) Local $secondSplit = StringSplit($firstSplit[2], ",") Local $dataArray[7] For $i=1 to $secondSplit[0] Local $data = $secondSplit[$i] If StringLeft($data,2) = '":' Then $dataArray[0] = StringTrimLeft($data,2) If StringInStr($data,'username') Then $tmpUsername = StringSplit($data,':') $tmpUsername[2] = StringTrimLeft($tmpUsername[2],1) $tmpUsername[2] = StringTrimRight($tmpUsername[2],1) $dataArray[1] = $tmpUsername[2] EndIf If StringInStr($data,'"chat"') Then $tmpChatID = StringSplit($data,':') $dataArray[2] = $tmpChatID[3] EndIf If StringInStr($data,'text') Then $tmpText = StringSplit($data,':') If StringInStr($tmpText[2],'"}}]}') Then $tmpText[2] = StringTrimLeft($tmpText[2],1) $tmpText[2] = StringTrimRight($tmpText[2],5) $dataArray[3] = $tmpText[2] ElseIf StringInStr($tmpText[2],'"}}') Then $tmpText[2] = StringTrimLeft($tmpText[2],1) $tmpText[2] = StringTrimRight($tmpText[2],3) $dataArray[3] = $tmpText[2] ElseIf StringInStr($tmpText[2],'"}') Then $tmpText[2] = StringTrimLeft($tmpText[2],1) $tmpText[2] = StringTrimRight($tmpText[2],2) $dataArray[3] = $tmpText[2] ElseIf StringRight($tmpText[2],1) = '"' Then $tmpText[2] = StringTrimLeft($tmpText[2],1) $tmpText[2] = StringTrimRight($tmpText[2],1) $dataArray[3] = $tmpText[2] EndIf EndIf If StringInStr($data,'callback_query') Then $tmpCallBQ = StringSplit($data,':') $tmpCallBQ[3] = StringTrimLeft($tmpCallBQ[3],1) $tmpCallBQ[3] = StringTrimRight($tmpCallBQ[3],1) $dataArray[4] = $tmpCallBQ[3] EndIf If StringInStr($data,'data') Then $tmpCallBData = StringSplit($data,':') If StringInStr($tmpCallBData[2],'"}}]}') Then $tmpCallBData[2] = StringTrimLeft($tmpCallBData[2],1) $tmpCallBData[2] = StringTrimRight($tmpCallBData[2],5) $tmpCallBData[2] = $tmpCallBData[2] $dataArray[5] = $tmpCallBData[2] ElseIf StringInStr($tmpCallBData[2],'"}}') Then $tmpCallBData[2] = StringTrimLeft($tmpCallBData[2],1) $tmpCallBData[2] = StringTrimRight($tmpCallBData[2],3) $dataArray[5] = $tmpCallBData[2] ElseIf StringInStr($tmpCallBData[2],'"}') Then $tmpCallBData[2] = StringTrimLeft($tmpCallBData[2],1) $tmpCallBData[2] = StringTrimRight($tmpCallBData[2],2) $dataArray[5] = $tmpCallBData[2] ElseIf StringRight($tmpCallBData[2],1) = '"' Then $tmpCallBData[2] = StringTrimLeft($tmpCallBData[2],1) $tmpCallBData[2] = StringTrimRight($tmpCallBData[2],1) $dataArray[5] = $tmpCallBData[2] EndIf EndIf If StringInStr($data,'message_id') Then $tmpMsgID = StringSplit($data,':') $dataArray[6] = $tmpMsgID[3] EndIf Next If $dataArray[1] = '' Then For $i=1 to $secondSplit[0] If StringInStr($secondSplit[$i],'first_name') Then $tmpUsername = StringSplit($secondSplit[$i],':') $tmpUsername[2] = StringTrimLeft($tmpUsername[2],1) $tmpUsername[2] = StringTrimRight($tmpUsername[2],1) $dataArray[1] = $tmpUsername[2] EndIf Next EndIf Return $dataArray EndFunc ;==> _JSONDecode Func _answerCallbackQuery($ChatID, $Text, $Alert = True, $Cache_time = '5') Local $Query = $URL & "/answerCallbackQuery?callback_query_id=" & $ChatID &"&text=" & $Text & "&show_alert=" & $Alert & "&cache_time=" & $Cache_time Local $Response = HttpPost($Query) ;Return $Response Return True EndFunc ;==> _answerCallbackQuery Func _editMessageReplyMarkup($ChatID, $Message_id, $Reply_markup) Local $Query = $URL & "/editMessageReplyMarkup?chat_id=" & $ChatID &"&message_id=" & $Message_id & "&reply_markup=" & $Reply_markup Local $Response = HttpPost($Query) ;Return $Response Return True EndFunc ;==> _editMessageReplyMarkup Func _editMessageText($ChatID, $Message_id, $Text, $Reply_markup) Local $Query = $URL & "/editMessageText?chat_id=" & $ChatID &"&message_id=" & $Message_id & "&text=" & $Text & "&reply_markup=" & $Reply_markup Local $Response = HttpPost($Query) ;Return $Response Return True EndFunc ;==> _editMessageText Edited March 9, 2017 by sakamoto Link to comment Share on other sites More sharing options...
LinkOut Posted March 9, 2017 Author Share Posted March 9, 2017 (edited) 21 hours ago, sakamoto said: <snip> <snip> Wow, awesome work. Thank you for share. I'm trying to find an easy way to split the message like json_decode function in PHP to make easier this process. Edited March 10, 2017 by Melba23 Removed huge unecessary quote Link to comment Share on other sites More sharing options...
volond Posted March 10, 2017 Share Posted March 10, 2017 http://demon.tw/programming/vbs-parse-json.html Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 10, 2017 Moderators Share Posted March 10, 2017 LinkOut, When you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - responders know what they wrote and it just pads the thread unnecessarily. volond, Welcome to the AutoIt forums. But as this is an English speaking forum, it would have helped more if you had translated the link. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Siwa Posted April 11, 2017 Share Posted April 11, 2017 can someone please help me where to find CHATID and BOTID ? @BotFather only gives me token of the bot. Thanks. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 11, 2017 Developers Share Posted April 11, 2017 (edited) CHATID is the id of the person the BOT receives/sends the messages to, so simply send an messages from your personal telegram account to the BOTID you have created and then read that message with the BOT's account information. You will find the CHATID in the returned JSON information. Jos Edited April 11, 2017 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
cjcjd99 Posted September 6, 2017 Share Posted September 6, 2017 THere one thing i think forgetten : This UDF does'nt Have Any Command To Get Message ID For Forwarding Link to comment Share on other sites More sharing options...
mintea Posted September 12, 2017 Share Posted September 12, 2017 I can't make the send file working such as photo, same result to run with the test file by changing the path. Console write Send photo error 4 Test _SendPhoto -> 0 Link to comment Share on other sites More sharing options...
Bahadur2 Posted October 8, 2017 Share Posted October 8, 2017 can any body tell me, how use line break or new line . i try using @CR , @LF and @CRLF but not working. $msreply= "Wellcome To 'Zoo World'." & @CRLF & " You can control by sending these commands: ......" _SendMsg($msgData[2],$msreply ) Link to comment Share on other sites More sharing options...
Developers Jos Posted October 8, 2017 Developers Share Posted October 8, 2017 Try this version: $msreply= "Wellcome To 'Zoo World'.%0AYou can control by sending these commands: ......" _SendMsg($msgData[2],$msreply ) Jos Skysnake 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
nend Posted October 10, 2017 Share Posted October 10, 2017 I'm somewhere lost in this. I made a bot and have a token, botname and a username. How can I send a message to a telegram account from a AutoIt script? #include "Telegram UDF.au3" $ChatID = "Your_Chat_ID_For_Test" _InitBot("Bot_ID","Bot_Token") ConsoleWrite("Test _GetUpdates -> " & @TAB & _GetUpdates() & @CRLF) ConsoleWrite("Test _GetMe -> " & @TAB & _GetMe() & @CRLF) ConsoleWrite("Test _SendMsg -> " & @TAB & _SendMsg($ChatID,"Test _SendMsg") & @CRLF) ConsoleWrite("Test _ForwardMsg -> " & @TAB & _ForwardMsg($ChatID,$ChatID,'MsgID') & @CRLF) ConsoleWrite("Test _SendPhoto -> " & @TAB & _SendPhoto($ChatID,"C:\image.jpg","Test _SendPhoto") & @CRLF) ConsoleWrite("Test _SendVideo -> " & @TAB & _SendVideo($ChatID,"C:\video.mp4","Test _SendVideo") & @CRLF) ConsoleWrite("Test _SendAudio -> " & @TAB & _SendAudio($ChatID,"C:\audio.mp3","Test _SendAudio") & @CRLF) ConsoleWrite("Test _SendDocument -> " & @TAB & _SendDocument($ChatID,"C:\document.txt","Test _SendDocument") & @CRLF) ConsoleWrite("Test _SendVoice -> " & @TAB & _SendVoice($ChatID,"C:\voice.ogg","Test _SendVoice") & @CRLF) ConsoleWrite("Test _SendSticker -> " & @TAB & _SendSticker($ChatID,"C:\sticker.webp") & @CRLF) ConsoleWrite("Test _SendLocation -> " & @TAB & _SendLocation($ChatID,"74.808889","-42.275391") & @CRLF) ConsoleWrite("Test _SendContact -> " & @TAB & _SendContact($ChatID,"0123456789","Josh") & @CRLF) ConsoleWrite("Test _SendChatAction -> " & @TAB & _SendChatAction($ChatID,"typing") & @CRLF) ConsoleWrite("Test _GetUserProfilePhotos -> " & @TAB & _GetUserProfilePhotos($ChatID) & @CRLF) ConsoleWrite("Test _GetChat -> " & @TAB & _GetChat($ChatID) & @CRLF) While 1 $msgData = _Polling() _SendMsg($msgData[2],$msgData[3]) WEnd I use this test script and bot token is clear but what do I insert at Bot_id, is this the botname or the username? And how do I receive the chat_id so that I can send some text to a other telegram account? What ever I try to insert at the bot_id I just can get it to work. Link to comment Share on other sites More sharing options...
maskat Posted October 19, 2017 Share Posted October 19, 2017 HI I'm unable to make the SendPhoto working I've installed the curl-7.46.0 dowloaded here http://www.confusedbycode.com/curl/.. ( windows 8.1) but noway have u an idea thank you for your help Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now