D-Bot/readmes/Telegram/onmessage.lua

10 lines
412 B
Lua
Raw Normal View History

2015-05-29 12:45:34 -05:00
function encodeURI(s)
s = string.gsub(s, "([^%w%.%- ])", function(c) return string.format("%%%02X", string.byte(c)) end)
return string.gsub(s, " ", "+")
end
function on_msg_receive (msg)
local handle = io.popen( "wget [your BOT.php url here]?to="..encodeURI(msg.to.print_name).."&from="..encodeURI(msg.from.print_name).."&text="..encodeURI(msg.text) )
local result = handle:read("*a")
handle:close()
end