Advertisement
Aleksey2093

Telegram CC

Mar 23rd, 2024 (edited)
1,420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.48 KB | None | 0 0
  1. local botToken = "YOUR_BOT_TOKEN"
  2. local chatId = "CHAT_ID" -- Or user ID
  3. local message = "Hello from ComputerCraft Lua!"
  4.  
  5. local apiEndpoint = "https://api.telegram.org/bot" .. botToken .. "/sendMessage?chat_id=" .. chatId .. "&text=" .. message
  6.  
  7. local response = http.get(apiEndpoint)
  8.  
  9. if response then
  10.     local responseData = response.readAll()
  11.     response.close()
  12.    
  13.     print("Telegram API Response:")
  14.     print(responseData)
  15. else
  16.     print("Failed to send message.")
  17. end
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement