Jump to content

aldrovan

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by aldrovan

  1. sorry again but i have also another strange thing in practical , the for repeat two time , i have this function Func _TelegramBotCurl($token, $data) ;_ArrayDisplay($data) $Action = "sendSticker" $URL = "https://api.telegram.org/bot" & $token & "/" & $Action ;$data="CAACAgQAAxkBAAEF9T1jNpkkuWRDVYKHnPUPFXFBTl0MGwACMQwAAjIXuVEc6LihmiTkbSoE" $dataTop = "CAACAgQAAxkBAAEF9T9jNplFM3b-9DDg3zyPZhhpO7eEmQACDiAAAmSKPgABEwY6mWO8PJMqBA" Run(@ComSpec & " /c " & @ScriptDir & '\curl\bin\curl.exe commandName -v -X POST --silent --output /dev/null ' & $URL & ' -d chat_id=' & $ChatID & ' -d sticker=' & $dataTop, "", @SW_HIDE) ; don't forget " " before "/c" $Action = "sendMessage" $URL = "https://api.telegram.org/bot" & $token & "/" & $Action $cicle = UBound($data) / 4 Local $a = 0, $b = 1, $c = 2, $d = 3 Sleep(3000) For $i = 1 To $cicle ;MsgBox(0,'',$data[$a]) $text= "Data:_"& $data[$a]& "%0A" & _ "Data:_" & $data[$b] & "%0A" & _ "Data:_" & $data[$c] & "%0A" & _ "Data:_"& $data[$d]& "%0A" & @CRLF Run(@ComSpec & " /c " & @ScriptDir & '\curl\bin\curl.exe commandName -v -X POST --silent --output /dev/null ' & $URL & ' -d chat_id=' & $ChatID & ' -d text='&$text, "", @SW_HIDE) ; don't forget " " before "/c" $a += 4 $b += 4 $c += 4 $d += 4 Sleep(3000) If $d > UBound($data) or $i = $cicle Then If ProcessExists("curl.exe") Then ; Check if the internet esplorer process is running. ProcessClose("curl.exe") EndIf ExitLoop EndIf Next $Action = "sendSticker" $URL = "https://api.telegram.org/bot" & $token & "/" & $Action ;$data="CAACAgQAAxkBAAEF9T1jNpkkuWRDVYKHnPUPFXFBTl0MGwACMQwAAjIXuVEc6LihmiTkbSoE" $data = "CAACAgQAAxkBAAEF9T9jNplFM3b-9DDg3zyPZhhpO7eEmQACDiAAAmSKPgABEwY6mWO8PJMqBA" Run(@ComSpec & " /c " & @ScriptDir & '\curl\bin\curl.exe commandName -v -X POST --silent --output /dev/null ' & $URL & ' -d chat_id=' & $ChatID & ' -d sticker=' & $dataTop, "", @SW_HIDE) ; don't forget " " before "/c" EndFunc ;==>_TelegramBotCurl in this function i have this array $data with 8 row with data i subdivide in 2 block with $cicle = UBound($data) / 4 Local $a = 0, $b = 1, $c = 2, $d = 3 Sleep(3000) For $i = 1 To $cicle but firstime work good but after not exit loop and repeat again two time o_O why ??? thanks
  2. hi fellows i try to send a text like this data: 30-09-2022 other: blalbalb etc: xxxxxx in telegram by curl i use this syntax $Action = "sendMessage" $URL = "https://api.telegram.org/bot" & $token & "/" & $Action $cicle = UBound($data) / 4 Local $a = 0, $b = 1, $c = 2, $d = 3 For $i = 0 To $cicle MsgBox(0,'',$data[$a]) $text= "Data: "& $data[$a] MsgBox(0,'',$text) Run(@ComSpec & " /c " & @ScriptDir & '\curl\bin\curl.exe commandName -v -X POST --silent --output /dev/null ' & $URL & ' -d chat_id=' & $ChatID & ' -d text='&$text, "", @SW_HIDE) ; don't forget " " before "/c" $a += 4 $b += 4 $c += 4 $d += 4 If $d > UBound($data) Then ExitLoop EndIf Next the strange things is if i use $text= "Data: "& $data[$a] send me only text Data: without a array if $text= $data[$a] send me only a data 29-09-2022 but why ??? thanks
  3. Hi sorry if i disturb i try to use the example of this udf but return me this error Test file for Telegram UDF (https://github.com/xLinkOut/telegram-udf-autoit). This file need a valid ChatID of a Telegram user who has already sent at least a message to the bot, and a valid token given by @BotFather. Insert this data in the source code. (1104) : ==> The requested action with this object has failed.: $oHTTP.Send() $oHTTP^ ERROR but i ma sure 100% i use a correct CHat id And token the code but is a example code #include "../src/Telegram.au3" #include <Array.au3> ConsoleWrite("Test file for Telegram UDF (https://github.com/xLinkOut/telegram-udf-autoit)." & @CRLF & _ "This file need a valid ChatID of a Telegram user who has already sent at least a message to the bot, and a valid token given by @BotFather." & @CRLF & _ "Insert this data in the source code." & @CRLF & @CRLF) Local $ChatID = '-10000000000' ;Your ChatID here (take this from @MyTelegramID_bot) Local $Token = "xxxxxxxxxxxxxxxxxxx" ;Token here If(($ChatID = '') or ($Token = '')) Then ConsoleWrite("Warning! ChatID or Token not specified!") Exit -1 EndIf ConsoleWrite("! Initializing bot... " & _InitBot($Token) & @CRLF & @CRLF) ConsoleWrite("Who am I? ") Local $myData = _GetMe() ConsoleWrite("Oh, yeah, my name is " & $myData[2] & ", you can find me at @" & $myData[1] & ". For developers, my Telegram ID is " & $myData[0] & @CRLF) ConsoleWrite("Let's do some test:" & @CRLF) ConsoleWrite(@TAB & "Sending a simple text message. The function _SendMsg return the Message ID: ") $MsgID = _SendMsg($ChatID,"Hi! I'm " & $myData[2] & " :)") ConsoleWrite($MsgID & @CRLF) ;ConsoleWrite(@TAB & "Now I'll forward the same message to you, with the message id saved before: " & _ForwardMsg($ChatID,$ChatID,$MsgID) & @CRLF) ConsoleWrite(@TAB & "Awesome. Use the other _Send functions to send photos, videos, documents. Each function return the FileID assigned by Telegram." & @CRLF) ConsoleWrite("!" & @TAB & @TAB & "Sending photo: " & _SendPhoto($ChatID,'media/image.png',"This is a photo.") & @CRLF) ConsoleWrite("!" & @TAB & @TAB & "Sending video: " & _SendVideo($ChatID,'media/video.mp4',"This is a video.") & @CRLF) ConsoleWrite("!" & @TAB & @TAB & "Sending audio: " & _SendAudio($ChatID,'media/audio.mp3',"This is an audio.") & @CRLF) ConsoleWrite("!" & @TAB & @TAB & "Sending documents: " & _SendDocument($ChatID,'media/text.txt',"This is a document.") & @CRLF) ConsoleWrite("!" & @TAB & @TAB & "Sending voice: " & _SendVoice($ChatID,'media/voice.ogg',"This is a voice.") & @CRLF) ConsoleWrite("!" & @TAB & @TAB & "Sending sticker: " & _SendSticker($ChatID,'media/sticker.webp') & @CRLF) ConsoleWrite("!" & @TAB & @TAB & "Sending video note: " & _SendVideoNote($ChatID,'media/video.mp4') & @CRLF) ConsoleWrite("!" & @TAB & @TAB & "Sending location: " & _SendLocation($ChatID,"74.808889","-42.275391") & @CRLF) ConsoleWrite("!" & @TAB & @TAB & "Sending contact: " & _SendContact($ChatID,"0123456789","John","Doe") & @CRLF & @CRLF) ConsoleWrite("You can send a 'Chat Action', that mean the user see 'Bot is typing...' or 'Bot is sending a photo...'." & @CRLF & @CRLF) _SendChatAction($ChatID,'typing') ConsoleWrite("To use a custom keyboard, there is an useful function that contruct and encode the keyboard itself." & @CRLF & _ "You have to create an array and insert the text of your buttons. To line break, leave a position empty. " & @CRLF & _ "Example, try to pass this array $keyboard[4] = ['TopLeft','TopRight','','SecondRow'] to the _CreateKeyboard function, then send the message." & @CRLF & @CRLF) Local $keyboard[4] = ['TopLeft','TopRight','','SecondRow'] Local $markup = _CreateKeyboard($keyboard) ConsoleWrite("In encoded format, the $keyboard look like " & $markup & @CRLF & _ "I'll send this keyboard to you as this: _SendMsg($ChatID,'Hey! Choose one:',Default,$markup)" & @CRLF) _SendMsg($ChatID,'Hey! Choose one:',Default,$markup) ConsoleWrite("_CreateKeyboard function accept two other boolean args, resize and one time keyboard, both false by default." & @CRLF & @CRLF) ConsoleWrite("This is all folks! For all the other methods read the Telegram Documentation and the Telegram.au3 file, it's commented. You can find some examples in the example folder." & @CRLF) ConsoleWrite("Don't forget to ì star this repo on GitHub, this mean a lot for me.") thanks
×
×
  • Create New...