From 6114207fd104a55aa36a142a7c6817f857ae0e54 Mon Sep 17 00:00:00 2001 From: Giorgos Logiotatidis Date: Sun, 4 Jan 2015 20:51:32 +0200 Subject: [PATCH 1/4] Typo fix. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f94b634..5d5cdbd 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Multimedia ---------- - When user sends image (png, jpg, jpeg) URL download and send it to origin. - When user sends media (gif, mp4, pdf, etc.) URL download and send it to origin. -- When user sends twitter URL, send text and images to origin. Requieres OAuth Key. +- When user sends twitter URL, send text and images to origin. Requires OAuth Key. - When user sends youtube URL, send to origin video image. ![http://i.imgur.com/0FGUvU0.png](http://i.imgur.com/0FGUvU0.png) ![http://i.imgur.com/zW7WWWt.png](http://i.imgur.com/zW7WWWt.png) ![http://i.imgur.com/zW7WWWt.png](http://i.imgur.com/kPK7paz.png) From 5cad0c67d7ccb011326fa3f8565aec0fb3fac035 Mon Sep 17 00:00:00 2001 From: Yago Date: Tue, 6 Jan 2015 21:40:11 +0100 Subject: [PATCH 2/4] Update README.md --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index 5d5cdbd..077b642 100644 --- a/README.md +++ b/README.md @@ -60,13 +60,6 @@ $ sudo cp etc/telegram.conf /etc/init/ $ ./launch.sh # Will ask you for a phone number & confirmation code. ``` -TODO ------------- -- [ ] Enable / Disable plugins -- [ ] Cron -- [ ] Regex -- [ ] Moar plugins - Contact me ------------ You can contact me [via Telegram](https://telegram.me/yago_perez) but if you have an issue please [open](https://github.com/yagop/telegram-bot/issues) one. From 2665a6dae8e0378955950b56c236d0dd5606cd7a Mon Sep 17 00:00:00 2001 From: Akshay S Dinesh Date: Sun, 11 Jan 2015 17:50:02 +0530 Subject: [PATCH 3/4] google search --- plugins/google.lua | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 plugins/google.lua diff --git a/plugins/google.lua b/plugins/google.lua new file mode 100644 index 0000000..792131e --- /dev/null +++ b/plugins/google.lua @@ -0,0 +1,38 @@ +function googlethat(query) + local api = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&" + local parameters = "q=".. (URL.escape(query) or "") + + -- Do the request + local res, code = https.request(api..parameters) + if code ~=200 then return nil end + local data = json:decode(res) + local results={} + for key,result in ipairs(data.responseData.results) do + table.insert(results,{result.titleNoFormatting, result.url}) + end + return results +end + +function stringlinks(results) + local stringresults="" + for key,val in ipairs(results) do + stringresults=stringresults..val[1].." - "..val[2].."\n" + end + return stringresults +end + +function run(msg, matches) + vardump(matches) + local results = googlethat(matches[1]) + return stringlinks(results) +end + +return { + description = "Searches Google", + usage = "!google terms", + patterns = { + "^!google (.*)$", + "^.[g|G]oogle (.*)$" + }, + run = run +} From f50c130d9fb998c0558cfae03571d5164e76674f Mon Sep 17 00:00:00 2001 From: Akshay S Dinesh Date: Mon, 12 Jan 2015 09:07:58 +0530 Subject: [PATCH 4/4] fixed doubling of replies --- plugins/google.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/google.lua b/plugins/google.lua index 792131e..d3b22de 100644 --- a/plugins/google.lua +++ b/plugins/google.lua @@ -32,7 +32,7 @@ return { usage = "!google terms", patterns = { "^!google (.*)$", - "^.[g|G]oogle (.*)$" + "^%.[g|G]oogle (.*)$" }, run = run }