forked from yagop/telegram-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Indentation an little little little changes
- Loading branch information
Showing
20 changed files
with
498 additions
and
449 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,36 @@ | ||
do | ||
|
||
function imdb(movie) | ||
local http = require("socket.http") | ||
http.TIMEOUT = 5 | ||
local http = require("socket.http") | ||
http.TIMEOUT = 5 | ||
|
||
movie = movie:gsub(' ', '+') | ||
url = "http://www.imdbapi.com/?t=" .. movie | ||
response, code, headers = http.request(url) | ||
local movie = movie:gsub(' ', '+') | ||
local url = "http://www.imdbapi.com/?t=" .. movie | ||
local response, code, headers = http.request(url) | ||
|
||
if code ~= 200 then | ||
return "Error: " .. code | ||
end | ||
if code ~= 200 then | ||
return "Error: " .. code | ||
end | ||
|
||
if #response > 0 then | ||
r = json:decode(response) | ||
r['Url'] = "http://imdb.com/title/" .. r.imdbID | ||
t = "" | ||
for k, v in pairs(r) do t = t .. k .. ": " .. v .. ", " end | ||
return t:sub(1, -3) | ||
end | ||
return nil | ||
if #response > 0 then | ||
local r = json:decode(response) | ||
r['Url'] = "http://imdb.com/title/" .. r.imdbID | ||
local t = "" | ||
for k, v in pairs(r) do t = t .. k .. ": " .. v .. ", " end | ||
return t:sub(1, -3) | ||
end | ||
return nil | ||
end | ||
|
||
function run(msg, matches) | ||
return imdb(matches[1]) | ||
return imdb(matches[1]) | ||
end | ||
|
||
return { | ||
description = "Imdb plugin for telegram", | ||
usage = "!imdb [movie]", | ||
patterns = {"^!imdb (.+)"}, | ||
run = run | ||
description = "Imdb plugin for telegram", | ||
usage = "!imdb [movie]", | ||
patterns = {"^!imdb (.+)"}, | ||
run = run | ||
} | ||
|
||
end |
Oops, something went wrong.