trivial stuff
This commit is contained in:
parent
1e99a9a1f3
commit
e92beeb58a
@ -410,3 +410,4 @@ Contributions are appreciated in all forms. Monetary contributions will go towar
|
|||||||
| [n8 c00](http://telegram.me/n8_c00) |
|
| [n8 c00](http://telegram.me/n8_c00) |
|
||||||
| [Alex](http://telegram.me/sandu) |
|
| [Alex](http://telegram.me/sandu) |
|
||||||
| [Brayden](http://telegram.me/bb010g) |
|
| [Brayden](http://telegram.me/bb010g) |
|
||||||
|
| [Milad](http://telegram.me/thelad) |
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
local bindings = {}
|
local bindings = {}
|
||||||
|
|
||||||
local HTTPS = require('ssl.https')
|
local https = require('ssl.https')
|
||||||
local JSON = require('dkjson')
|
local json = require('dkjson')
|
||||||
local ltn12 = require('ltn12')
|
local ltn12 = require('ltn12')
|
||||||
local MP_ENCODE = require('multipart-post').encode
|
local mp_encode = require('multipart-post').encode
|
||||||
|
|
||||||
function bindings.init(token)
|
function bindings.init(token)
|
||||||
bindings.BASE_URL = 'https://api.telegram.org/bot' .. token .. '/'
|
bindings.BASE_URL = 'https://api.telegram.org/bot' .. token .. '/'
|
||||||
@ -58,8 +58,8 @@ function bindings.request(method, parameters, file)
|
|||||||
parameters = {''}
|
parameters = {''}
|
||||||
end
|
end
|
||||||
local response = {}
|
local response = {}
|
||||||
local body, boundary = MP_ENCODE(parameters)
|
local body, boundary = mp_encode(parameters)
|
||||||
local success, code = HTTPS.request{
|
local success, code = https.request{
|
||||||
url = bindings.BASE_URL .. method,
|
url = bindings.BASE_URL .. method,
|
||||||
method = 'POST',
|
method = 'POST',
|
||||||
headers = {
|
headers = {
|
||||||
@ -74,7 +74,7 @@ function bindings.request(method, parameters, file)
|
|||||||
print(method .. ': Connection error. [' .. code .. ']')
|
print(method .. ': Connection error. [' .. code .. ']')
|
||||||
return false, false
|
return false, false
|
||||||
else
|
else
|
||||||
local result = JSON.decode(data)
|
local result = json.decode(data)
|
||||||
if not result then
|
if not result then
|
||||||
return false, false
|
return false, false
|
||||||
elseif result.ok then
|
elseif result.ok then
|
||||||
|
Reference in New Issue
Block a user