diff --git a/bot/bot.lua b/bot/bot.lua index 3ea32b0..98059f4 100644 --- a/bot/bot.lua +++ b/bot/bot.lua @@ -1,6 +1,6 @@ require("./bot/utils") -VERSION = '0.11.2' +VERSION = '2.5-reloaded' -- This function is called when tg receive a msg function on_msg_receive (msg) @@ -76,7 +76,7 @@ local function is_plugin_disabled_on_chat(plugin_name, receiver) for disabled_plugin,disabled in pairs(disabled_chats[receiver]) do print(disabled_plugin) if disabled_plugin == plugin_name and disabled then - local warning = 'Plugin '..disabled_plugin..' is disabled on this chat' + local warning = '' print(warning) send_msg(receiver, warning, ok_cb, false) return true diff --git a/bot/utils.lua b/bot/utils.lua index 005e93e..39ef535 100644 --- a/bot/utils.lua +++ b/bot/utils.lua @@ -99,7 +99,7 @@ function download_to_file(url, file_name) file_name = file_name or get_http_file_name(url, headers) - local file_path = "/tmp/"..file_name + local file_path = "/home/pi/Mikubot/tmp/"..file_name print("Saved to: "..file_path) file = io.open(file_path, "w+") diff --git a/pictures/Nii-san.jpg b/pictures/Nii-san.jpg new file mode 100644 index 0000000..426ba65 Binary files /dev/null and b/pictures/Nii-san.jpg differ diff --git a/pictures/aha.png b/pictures/aha.png new file mode 100644 index 0000000..87cc09e Binary files /dev/null and b/pictures/aha.png differ diff --git a/pictures/cats/cat1.jpg b/pictures/cats/cat1.jpg new file mode 100644 index 0000000..071d417 Binary files /dev/null and b/pictures/cats/cat1.jpg differ diff --git a/pictures/cats/cat2.jpg b/pictures/cats/cat2.jpg new file mode 100644 index 0000000..0054f74 Binary files /dev/null and b/pictures/cats/cat2.jpg differ diff --git a/pictures/cats/cat3.jpg b/pictures/cats/cat3.jpg new file mode 100644 index 0000000..f26d6d8 Binary files /dev/null and b/pictures/cats/cat3.jpg differ diff --git a/pictures/cats/cat4.jpg b/pictures/cats/cat4.jpg new file mode 100644 index 0000000..512e3ad Binary files /dev/null and b/pictures/cats/cat4.jpg differ diff --git a/pictures/luckystar/Thumbs.db b/pictures/luckystar/Thumbs.db new file mode 100644 index 0000000..b0e0d9e Binary files /dev/null and b/pictures/luckystar/Thumbs.db differ diff --git a/pictures/luckystar/barusamikosu.jpg b/pictures/luckystar/barusamikosu.jpg new file mode 100644 index 0000000..d537723 Binary files /dev/null and b/pictures/luckystar/barusamikosu.jpg differ diff --git a/pictures/luckystar/kagami.jpg b/pictures/luckystar/kagami.jpg new file mode 100644 index 0000000..2a5dff6 Binary files /dev/null and b/pictures/luckystar/kagami.jpg differ diff --git a/pictures/luckystar/konata.jpg b/pictures/luckystar/konata.jpg new file mode 100644 index 0000000..8f6848b Binary files /dev/null and b/pictures/luckystar/konata.jpg differ diff --git a/pictures/luckystar/miyuki.jpg b/pictures/luckystar/miyuki.jpg new file mode 100644 index 0000000..d8be57b Binary files /dev/null and b/pictures/luckystar/miyuki.jpg differ diff --git a/pictures/luckystar/tsukasa.jpg b/pictures/luckystar/tsukasa.jpg new file mode 100644 index 0000000..2f3314c Binary files /dev/null and b/pictures/luckystar/tsukasa.jpg differ diff --git a/pictures/nau.jpg b/pictures/nau.jpg new file mode 100644 index 0000000..ced87a7 Binary files /dev/null and b/pictures/nau.jpg differ diff --git a/pictures/neorame.jpg b/pictures/neorame.jpg new file mode 100644 index 0000000..e5d7f54 Binary files /dev/null and b/pictures/neorame.jpg differ diff --git a/pictures/nyu.jpg b/pictures/nyu.jpg new file mode 100644 index 0000000..d3491b9 Binary files /dev/null and b/pictures/nyu.jpg differ diff --git a/pictures/sakurasou/Thumbs.db b/pictures/sakurasou/Thumbs.db new file mode 100644 index 0000000..4170319 Binary files /dev/null and b/pictures/sakurasou/Thumbs.db differ diff --git a/pictures/sakurasou/chihiro.jpg b/pictures/sakurasou/chihiro.jpg new file mode 100644 index 0000000..a274832 Binary files /dev/null and b/pictures/sakurasou/chihiro.jpg differ diff --git a/pictures/sakurasou/jin.jpg b/pictures/sakurasou/jin.jpg new file mode 100644 index 0000000..f80c442 Binary files /dev/null and b/pictures/sakurasou/jin.jpg differ diff --git a/pictures/sakurasou/misaki.jpg b/pictures/sakurasou/misaki.jpg new file mode 100644 index 0000000..e21f0b6 Binary files /dev/null and b/pictures/sakurasou/misaki.jpg differ diff --git a/pictures/sakurasou/nanami.jpg b/pictures/sakurasou/nanami.jpg new file mode 100644 index 0000000..bce34fb Binary files /dev/null and b/pictures/sakurasou/nanami.jpg differ diff --git a/pictures/sakurasou/ryuunosuke.jpg b/pictures/sakurasou/ryuunosuke.jpg new file mode 100644 index 0000000..9a4d266 Binary files /dev/null and b/pictures/sakurasou/ryuunosuke.jpg differ diff --git a/pictures/sakurasou/shiina.jpg b/pictures/sakurasou/shiina.jpg new file mode 100644 index 0000000..22446aa Binary files /dev/null and b/pictures/sakurasou/shiina.jpg differ diff --git a/pictures/sakurasou/sorata.jpg b/pictures/sakurasou/sorata.jpg new file mode 100644 index 0000000..3011a92 Binary files /dev/null and b/pictures/sakurasou/sorata.jpg differ diff --git a/pictures/senrankagura/hanzouacademy/Thumbs.db b/pictures/senrankagura/hanzouacademy/Thumbs.db new file mode 100644 index 0000000..31aacf6 Binary files /dev/null and b/pictures/senrankagura/hanzouacademy/Thumbs.db differ diff --git a/pictures/senrankagura/hanzouacademy/asuka.jpg b/pictures/senrankagura/hanzouacademy/asuka.jpg new file mode 100644 index 0000000..2f26d81 Binary files /dev/null and b/pictures/senrankagura/hanzouacademy/asuka.jpg differ diff --git a/pictures/senrankagura/hanzouacademy/hibari.jpg b/pictures/senrankagura/hanzouacademy/hibari.jpg new file mode 100644 index 0000000..b28c5dd Binary files /dev/null and b/pictures/senrankagura/hanzouacademy/hibari.jpg differ diff --git a/pictures/senrankagura/hanzouacademy/ikaruga.jpg b/pictures/senrankagura/hanzouacademy/ikaruga.jpg new file mode 100644 index 0000000..c71b97c Binary files /dev/null and b/pictures/senrankagura/hanzouacademy/ikaruga.jpg differ diff --git a/pictures/senrankagura/hanzouacademy/katsuragi.jpg b/pictures/senrankagura/hanzouacademy/katsuragi.jpg new file mode 100644 index 0000000..0533eab Binary files /dev/null and b/pictures/senrankagura/hanzouacademy/katsuragi.jpg differ diff --git a/pictures/senrankagura/hanzouacademy/yagyuu.jpg b/pictures/senrankagura/hanzouacademy/yagyuu.jpg new file mode 100644 index 0000000..b922959 Binary files /dev/null and b/pictures/senrankagura/hanzouacademy/yagyuu.jpg differ diff --git a/pictures/senrankagura/hebijoacademy/Thumbs.db b/pictures/senrankagura/hebijoacademy/Thumbs.db new file mode 100644 index 0000000..7d61adb Binary files /dev/null and b/pictures/senrankagura/hebijoacademy/Thumbs.db differ diff --git a/pictures/senrankagura/hebijoacademy/haruka.jpg b/pictures/senrankagura/hebijoacademy/haruka.jpg new file mode 100644 index 0000000..fa63067 Binary files /dev/null and b/pictures/senrankagura/hebijoacademy/haruka.jpg differ diff --git a/pictures/senrankagura/hebijoacademy/hikage.jpg b/pictures/senrankagura/hebijoacademy/hikage.jpg new file mode 100644 index 0000000..6ab1e1f Binary files /dev/null and b/pictures/senrankagura/hebijoacademy/hikage.jpg differ diff --git a/pictures/senrankagura/hebijoacademy/homura.jpg b/pictures/senrankagura/hebijoacademy/homura.jpg new file mode 100644 index 0000000..5fba038 Binary files /dev/null and b/pictures/senrankagura/hebijoacademy/homura.jpg differ diff --git a/pictures/senrankagura/hebijoacademy/mirai.jpg b/pictures/senrankagura/hebijoacademy/mirai.jpg new file mode 100644 index 0000000..a06269b Binary files /dev/null and b/pictures/senrankagura/hebijoacademy/mirai.jpg differ diff --git a/pictures/senrankagura/hebijoacademy/yomi.jpg b/pictures/senrankagura/hebijoacademy/yomi.jpg new file mode 100644 index 0000000..960cbd1 Binary files /dev/null and b/pictures/senrankagura/hebijoacademy/yomi.jpg differ diff --git a/plugins/9gag.lua b/plugins/9gag.lua index a370ade..5f5e43b 100644 --- a/plugins/9gag.lua +++ b/plugins/9gag.lua @@ -30,9 +30,9 @@ local function run(msg, matches) end return { - description = "9GAG for telegram", - usage = "!9gag: Send random image from 9gag", - patterns = {"^!9gag$"}, + description = "9GAG", + usage = "/9gag", + patterns = {"^/9gag$"}, run = run } diff --git a/plugins/afk.lua b/plugins/afk.lua new file mode 100644 index 0000000..4be1896 --- /dev/null +++ b/plugins/afk.lua @@ -0,0 +1,13 @@ +function run(msg, matches) + local user_name = get_name(msg) + return "" .. user_name .. " ist nun AFK" +end + +return { + description = "Sagt dass ihr afk seid", + usage = "/afk", + patterns = { + "^/afk(.*)$" + }, + run = run +} diff --git a/plugins/aha.png.lua b/plugins/aha.png.lua new file mode 100644 index 0000000..29511f6 --- /dev/null +++ b/plugins/aha.png.lua @@ -0,0 +1,13 @@ +function run(msg, matches) + + if string.starts(msg.text, "aha.png") then + send_photo(get_receiver(msg), "pictures/aha.png", ok_cb, false) + end +end + +return { + description = "Aha", + usage = "aha.png", + patterns = {"^aha.png"}, + run = run +} \ No newline at end of file diff --git a/plugins/baka_bot.lua b/plugins/baka_bot.lua new file mode 100644 index 0000000..f3cc728 --- /dev/null +++ b/plugins/baka_bot.lua @@ -0,0 +1,15 @@ + +function run(msg, matches) + return "Gomen'nasai ๐Ÿ˜ฃ" + end + +return { + description = "", + usage = "", + patterns = {"^baka bot", + "Baka bot", + "baka Bot", + "Baka Bot", + "BAKA BOT"}, + run = run +} diff --git a/plugins/barusamikosu.lua b/plugins/barusamikosu.lua new file mode 100644 index 0000000..d0d2b74 --- /dev/null +++ b/plugins/barusamikosu.lua @@ -0,0 +1,15 @@ +function run(msg, matches) + + if string.starts(msg.text, '/barusamiko') or string.starts(msg.text, "/barusamikosu") or string.starts(msg.text, "/Balsamiko Essig") then + send_photo(get_receiver(msg), "pictures/luckystar/barusamikosu.jpg", ok_cb, false) + end +end + +return { + description = "Balsamiko Essig!", + usage = "/barusamiko", + patterns = {"^/barusamiko", + "^/barusamikosu", + "^/Balsamiko Essig"}, + run = run +} \ No newline at end of file diff --git a/plugins/boobs.lua b/plugins/boobs.lua index 49d1835..60c06e3 100644 --- a/plugins/boobs.lua +++ b/plugins/boobs.lua @@ -11,7 +11,7 @@ function getRandomButts(attempt) -- The OpenBoobs API sometimes returns an empty array if not data and attempt < 10 then - print('Cannot get that butts, trying another ones...') + print('Keine Butts gefunden!') return getRandomButts(attempt) end @@ -29,7 +29,7 @@ function getRandomBoobs(attempt) -- The OpenBoobs API sometimes returns an empty array if not data and attempt < 10 then - print('Cannot get that boobs, trying another ones...') + print('Keine Boobs gefunden!') return getRandomBoobs(attempt) end @@ -39,11 +39,11 @@ end function run(msg, matches) local url = nil - if matches[1] == "!boobs" then + if matches[1] == "/boobs" then url = getRandomBoobs() end - if matches[1] == "!butts" then + if matches[1] == "/butts" then url = getRandomButts() end @@ -51,19 +51,19 @@ function run(msg, matches) local receiver = get_receiver(msg) send_photo_from_url(receiver, url) else - return 'Error getting boobs/butts for you, please try again later.' + return 'Keine Boobs/Butts gefunden.' end end return { - description = "Gets a random boobs or butts pic", + description = "Sendet ein zufไlliges Boobs/Butts Bild", usage = { - "!boobs: Get a boobs NSFW image. ๐Ÿ”ž", - "!butts: Get a butts NSFW image. ๐Ÿ”ž" + "/boobs", + "/butts" }, patterns = { - "^!boobs$", - "^!butts$" + "^/boobs$", + "^/butts$" }, run = run } diff --git a/plugins/btc.lua b/plugins/btc.lua deleted file mode 100644 index 2236355..0000000 --- a/plugins/btc.lua +++ /dev/null @@ -1,50 +0,0 @@ - -function getBTCX(amount,currency) - -- Do request on bitcoinaverage, the final / is critical! - local res,code = https.request("https://api.bitcoinaverage.com/ticker/global/"..currency.."/") - - if code~= 200 then return nil end - local data = json:decode(res) - - -- Easy, it's right there - text = "BTC/"..currency..'\n'..'Buy: '..data.ask..'\n'..'Sell: '..data.bid - - -- If we have a number as second parameter, calculate the bitcoin amount - if amount~=nil then - btc = tonumber(amount) / tonumber(data.ask) - text = text.."\n "..currency .." "..amount.." = BTC "..btc - end - return text -end - -function run(msg, matches) - vardump(matches) - local cur = 'EUR' - local amt = nil - -- Get the global match out of the way - if matches[1] == "!btc" then return getBTCX(amt,cur) end - - if matches[2]~=nil then - -- There is a second match - amt = matches[2] - cur = string.upper(matches[1]) - else - -- Just a EUR or USD param - cur = string.upper(matches[1]) - end - return getBTCX(amt,cur) -end - -return { - description = "Bitcoin global average market value (in EUR or USD)", - usage = "!btc [EUR|USD] [amount]", - patterns = { - "^!btc$", - "^!btc ([Ee][Uu][Rr])$", - "^!btc ([Uu][Ss][Dd])$", - "^!btc (EUR) (%d+[%d%.]*)$", - "^!btc (USD) (%d+[%d%.]*)$" - }, - run = run -} - diff --git a/plugins/bugzilla.lua b/plugins/bugzilla.lua deleted file mode 100644 index 8ed22de..0000000 --- a/plugins/bugzilla.lua +++ /dev/null @@ -1,106 +0,0 @@ -do - -local BASE_URL = "https://bugzilla.mozilla.org/rest/" - -function bugzilla_login() - local url = BASE_URL.."login?login=" .. _config.bugzilla.username .. "&password=" .. _config.bugzilla.password - print("accessing " .. url) - local res,code = https.request( url ) - data = json:decode(res) - return data -end - -function bugzilla_check(id) - -- data = bugzilla_login() - vardump(data) - local url = BASE_URL.."bug/" .. id .. "?api_key=" .. _config.bugzilla.apikey - -- print(url) - local res,code = https.request( url ) - data = json:decode(res) - return data -end - -function bugzilla_listopened(email) - local url = BASE_URL.."bug?include_fields=id,summary,status,whiteboard,resolution&email1=" .. email .. "&email2=" .. email .. "&emailassigned_to2=1&emailreporter1=1&emailtype1=substring&emailtype2=substring&f1=bug_status&f2=bug_status&n1=1&n2=1&o1=equals&o2=equals&resolution=---&v1=closed&v2=resolved&api_key=" .. _config.bugzilla.apikey - local res,code = https.request( url ) - print(res) - local data = json:decode(res) - return data -end - -function run(msg, matches) - - local response = "" - - if matches[1] == "status" then - data = bugzilla_check(matches[2]) - vardump(data) - if data.error == true then - return "Sorry, API failed with message: " .. data.message - else - response = "Bug #"..matches[1]..":\nReporter: "..data.bugs[1].creator - response = response .. "\n Last update: "..data.bugs[1].last_change_time - response = response .. "\n Status: "..data.bugs[1].status.." "..data.bugs[1].resolution - response = response .. "\n Whiteboard: "..data.bugs[1].whiteboard - response = response .. "\n Access: https://bugzilla.mozilla.org/show_bug.cgi?id=" .. matches[1] - print(response) - end - elseif matches[1] == "list" then - data = bugzilla_listopened(matches[2]) - - vardump(data) - if data.error == true then - return "Sorry, API failed with message: " .. data.message - else - - -- response = "Bug #"..matches[1]..":\nReporter: "..data.bugs[1].creator - -- response = response .. "\n Last update: "..data.bugs[1].last_change_time - -- response = response .. "\n Status: "..data.bugs[1].status.." "..data.bugs[1].resolution - -- response = response .. "\n Whiteboard: "..data.bugs[1].whiteboard - -- response = response .. "\n Access: https://bugzilla.mozilla.org/show_bug.cgi?id=" .. matches[1] - local total = table.map_length(data.bugs) - - print("total bugs: " .. total) - response = "There are " .. total .. " number of bug(s) assigned/reported by " .. matches[2] - - if total > 0 then - response = response .. ": " - - for tableKey, bug in pairs(data.bugs) do - response = response .. "\n #" .. bug.id - response = response .. "\n Status: " .. bug.status .. " " .. bug.resolution - response = response .. "\n Whiteboard: " .. bug.whiteboard - response = response .. "\n Summary: " .. bug.summary - end - end - end - - end - return response -end - --- (table) --- [bugs] = (table) --- [1] = (table) --- [status] = (string) ASSIGNED --- [id] = (number) 927704 --- [whiteboard] = (string) [approved][full processed] --- [summary] = (string) Budget Request - Arief Bayu Purwanto - https://reps.mozilla.org/e/mozilla-summit-2013/ --- [2] = (table) --- [status] = (string) ASSIGNED --- [id] = (number) 1049337 --- [whiteboard] = (string) [approved][full processed][waiting receipts][waiting report and photos] --- [summary] = (string) Budget Request - Arief Bayu Purwanto - https://reps.mozilla.org/e/workshop-firefox-os-pada-workshop-media-sosial-untuk-perubahan-1/ --- total bugs: 2 - -return { - description = "Lookup bugzilla status update", - usage = "/bot bugzilla [bug number]", - patterns = { - "^/bugzilla (status) (.*)$", - "^/bugzilla (list) (.*)$" - }, - run = run -} - -end \ No newline at end of file diff --git a/plugins/channels.lua b/plugins/channels.lua index b2d25b6..1154b4d 100644 --- a/plugins/channels.lua +++ b/plugins/channels.lua @@ -17,13 +17,13 @@ local function enable_channel(receiver) end if _config.disabled_channels[receiver] == nil then - return 'Channel isn\'t disabled' + return 'Channel ist nicht deaktiviert!' end _config.disabled_channels[receiver] = false save_config() - return "Channel reenabled" + return "Channel wieder aktiviert!" end local function disable_channel( receiver ) @@ -34,7 +34,7 @@ local function disable_channel( receiver ) _config.disabled_channels[receiver] = true save_config() - return "Channel disabled" + return "Channel deaktiviert!" end local function pre_process(msg) @@ -42,7 +42,7 @@ local function pre_process(msg) -- If is sudo can reeanble the channel if is_sudo(msg) then - if msg.text == "!channel enable" then + if msg.text == "/channel enable" then enable_channel(receiver) end end @@ -67,13 +67,11 @@ local function run(msg, matches) end return { - description = "Plugin to manage channels. Enable or disable channel.", - usage = { - "!channel enable: enable current channel", - "!channel disable: disable current channel" }, + description = "", + usage = {""}, patterns = { - "^!channel? (enable)", - "^!channel? (disable)" }, + "^/channel? (enable)", + "^/channel? (disable)" }, run = run, privileged = true, pre_process = pre_process diff --git a/plugins/echo.lua b/plugins/echo.lua index eba3aff..aa4c740 100644 --- a/plugins/echo.lua +++ b/plugins/echo.lua @@ -4,10 +4,10 @@ function run(msg, matches) end return { - description = "Simplest plugin ever!", - usage = "!echo [whatever]: echoes the msg", + description = "Wiederholt euch", + usage = "/echo [Satz]", patterns = { - "^!echo (.*)$" + "^/echo (.*)$" }, run = run } diff --git a/plugins/emoticons.lua b/plugins/emoticons.lua new file mode 100644 index 0000000..2b4a183 --- /dev/null +++ b/plugins/emoticons.lua @@ -0,0 +1,14 @@ + +function run(msg, matches) + if matches[1] == "/emoticons" then + return '๐Ÿ˜„๐Ÿ˜ƒ๐Ÿ˜€๐Ÿ˜Šโ˜บ๏ธ๐Ÿ˜‰๐Ÿ˜๐Ÿ˜˜๐Ÿ˜š๐Ÿ˜—๐Ÿ˜™๐Ÿ˜œ๐Ÿ˜๐Ÿ˜›๐Ÿ˜ณ๐Ÿ˜๐Ÿ˜”๐Ÿ˜Œ๐Ÿ˜’๐Ÿ˜ž๐Ÿ˜ฃ๐Ÿ˜ข๐Ÿ˜‚๐Ÿ˜ญ๐Ÿ˜ช๐Ÿ˜ฅ๐Ÿ˜ฐ๐Ÿ˜…๐Ÿ˜“๐Ÿ˜ฉ๐Ÿ˜ซ๐Ÿ˜จ๐Ÿ˜ฑ๐Ÿ˜ ๐Ÿ˜ก๐Ÿ˜ค๐Ÿ˜–๐Ÿ˜†๐Ÿ˜‹๐Ÿ˜ท๐Ÿ˜Ž๐Ÿ˜ด๐Ÿ˜ต๐Ÿ˜ฒ๐Ÿ˜Ÿ๐Ÿ˜ฆ๐Ÿ˜ง๐Ÿ˜ˆ๐Ÿ‘ฟ๐Ÿ˜ฎ๐Ÿ˜ฌ๐Ÿ˜๐Ÿ˜•๐Ÿ˜ฏ๐Ÿ˜ถ๐Ÿ˜‡๐Ÿ˜๐Ÿ˜‘๐Ÿ‘ฒ๐Ÿ‘ณ๐Ÿ‘ฎ๐Ÿ‘ท๐Ÿ’‚๐Ÿ‘ถ๐Ÿ‘ฆ๐Ÿ‘ง๐Ÿ‘จ๐Ÿ‘ฉ๐Ÿ‘ด๐Ÿ‘ต๐Ÿ‘ฑ๐Ÿ‘ผ๐Ÿ‘ธ๐Ÿ˜บ๐Ÿ˜ธ๐Ÿ˜ป๐Ÿ˜ฝ๐Ÿ˜ผ๐Ÿ™€๐Ÿ˜ฟ๐Ÿ˜น๐Ÿ˜พ๐Ÿ‘น๐Ÿ‘บ๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š๐Ÿ’€๐Ÿ‘ฝ๐Ÿ’ฉ๐Ÿ”ฅโœจ๐ŸŒŸ๐Ÿ’ซ๐Ÿ’ฅ๐Ÿ’ข๐Ÿ’ฆ๐Ÿ’ง๐Ÿ’ค๐Ÿ’จ๐Ÿ‘‚๐Ÿ‘€๐Ÿ‘ƒ๐Ÿ‘…๐Ÿ‘„๐Ÿ‘๐Ÿ‘Ž๐Ÿ‘Œ๐Ÿ‘ŠโœŠโœŒ๏ธ๐Ÿ‘‹โœ‹๐Ÿ‘๐Ÿ‘†๐Ÿ‘‡๐Ÿ‘‰๐Ÿ‘ˆ๐Ÿ™Œ๐Ÿ™โ˜๏ธ๐Ÿ‘๐Ÿ’ช๐Ÿšถ๐Ÿƒ๐Ÿ’ƒ๐Ÿ‘ซ๐Ÿ‘ช๐Ÿ‘ฌ๐Ÿ‘ญ๐Ÿ’๐Ÿ’‘๐Ÿ‘ฏ๐Ÿ™†๐Ÿ™…๐Ÿ’๐Ÿ™‹๐Ÿ’†๐Ÿ’‡๐Ÿ’…๐Ÿ‘ฐ๐Ÿ™Ž๐Ÿ™๐Ÿ™‡๐ŸŽฉ๐Ÿ‘‘๐Ÿ‘’๐Ÿ‘Ÿ๐Ÿ‘ž๐Ÿ‘ก๐Ÿ‘ ๐Ÿ‘ข๐Ÿ‘•๐Ÿ‘”๐Ÿ‘š๐Ÿ‘—๐ŸŽฝ๐Ÿ‘–๐Ÿ‘˜๐Ÿ‘™๐Ÿ’ผ๐Ÿ‘œ๐Ÿ‘๐Ÿ‘›๐Ÿ‘“๐ŸŽ€๐ŸŒ‚๐Ÿ’„๐Ÿ’›๐Ÿ’™๐Ÿ’œ๐Ÿ’šโค๏ธ๐Ÿ’”๐Ÿ’—๐Ÿ’“๐Ÿ’•๐Ÿ’–๐Ÿ’ž๐Ÿ’˜๐Ÿ’Œ๐Ÿ’‹๐Ÿ’๐Ÿ’Ž๐Ÿ‘ค๐Ÿ‘ฅ๐Ÿ’ฌ๐Ÿ‘ฃ๐Ÿ’ญ๐Ÿถ๐Ÿบ๐Ÿฑ๐Ÿญ๐Ÿน๐Ÿฐ๐Ÿธ๐Ÿฏ๐Ÿจ๐Ÿป๐Ÿท๐Ÿฝ๐Ÿฎ๐Ÿ—๐Ÿต๐Ÿ’๐Ÿด๐Ÿ‘๐Ÿ˜๐Ÿผ๐Ÿง๐Ÿฆ๐Ÿค๐Ÿฅ๐Ÿฃ๐Ÿ”๐Ÿ๐Ÿข๐Ÿ›๐Ÿ๐Ÿœ๐Ÿž๐ŸŒ๐Ÿ™๐Ÿš๐Ÿ ๐ŸŸ๐Ÿฌ๐Ÿณ๐Ÿ‹๐Ÿ„๐Ÿ๐Ÿ€๐Ÿƒ๐Ÿ…๐Ÿ‡๐Ÿ‰๐ŸŽ๐Ÿ๐Ÿ“๐Ÿ•๐Ÿ–๐Ÿ๐Ÿ‚๐Ÿฒ๐Ÿก๐ŸŠ๐Ÿซ๐Ÿช๐Ÿ†๐Ÿˆ๐Ÿฉ๐Ÿพ๐Ÿ’๐ŸŒธ๐ŸŒท๐Ÿ€๐ŸŒน๐ŸŒป๐ŸŒบ๐Ÿ๐Ÿƒ๐Ÿ‚๐ŸŒฟ๐ŸŒพ๐Ÿ„๐ŸŒต๐ŸŒด๐ŸŒฒ๐ŸŒณ๐ŸŒฐ๐ŸŒฑ๐ŸŒผ๐ŸŒ๐ŸŒž๐ŸŒ๐ŸŒš๐ŸŒ‘๐ŸŒ’๐ŸŒ“๐ŸŒ”๐ŸŒ•๐ŸŒ–๐ŸŒ—๐ŸŒ˜๐ŸŒœ๐ŸŒ›๐ŸŒ™๐ŸŒ๐ŸŒŽ๐ŸŒ๐ŸŒ‹๐ŸŒŒ๐ŸŒ โญ๏ธโ˜€๏ธโ›…๏ธโ˜๏ธโšก๏ธโ˜”๏ธโ„๏ธโ›„๏ธ๐ŸŒ€๐ŸŒ๐ŸŒˆ๐ŸŒŠ๐ŸŽ๐Ÿ’๐ŸŽŽ๐ŸŽ’๐ŸŽ“๐ŸŽ๐ŸŽ†๐ŸŽ‡๐ŸŽ๐ŸŽ‘๐ŸŽƒ๐Ÿ‘ป๐ŸŽ…๐ŸŽ„๐ŸŽ๐ŸŽ‹๐ŸŽ‰๐ŸŽŠ๐ŸŽˆ๐ŸŽŒ๐Ÿ”ฎ๐ŸŽฅ๐Ÿ“ท๐Ÿ“น๐Ÿ“ผ๐Ÿ’ฟ๐Ÿ“€๐Ÿ’ฝ๐Ÿ’พ๐Ÿ’ป๐Ÿ“ฑโ˜Ž๏ธ๐Ÿ“ž๐Ÿ“Ÿ๐Ÿ“ ๐Ÿ“ก๐Ÿ“บ๐Ÿ“ป๐Ÿ”Š๐Ÿ”‰๐Ÿ”ˆ๐Ÿ”‡๐Ÿ””๐Ÿ”•๐Ÿ“ข๐Ÿ“ฃโณโŒ›๏ธโฐโŒš๏ธ๐Ÿ”“๐Ÿ”’๐Ÿ”๐Ÿ”๐Ÿ”‘๐Ÿ”Ž๐Ÿ’ก๐Ÿ”ฆ๐Ÿ”†๐Ÿ”…๐Ÿ”Œ๐Ÿ”‹๐Ÿ”๐Ÿ›๐Ÿ›€๐Ÿšฟ๐Ÿšฝ๐Ÿ”ง๐Ÿ”ฉ๐Ÿ”จ๐Ÿšช๐Ÿšฌ๐Ÿ’ฃ๐Ÿ”ซ๐Ÿ”ช๐Ÿ’Š๐Ÿ’‰๐Ÿ’ฐ๐Ÿ’ด๐Ÿ’ต๐Ÿ’ท๐Ÿ’ถ๐Ÿ’ณ๐Ÿ’ธ๐Ÿ“ฒ๐Ÿ“ง๐Ÿ“ฅ๐Ÿ“คโœ‰๏ธ๐Ÿ“ฉ๐Ÿ“จ๐Ÿ“ฏ๐Ÿ“ซ๐Ÿ“ช๐Ÿ“ฌ๐Ÿ“ญ๐Ÿ“ฎ๐Ÿ“ฆ๐Ÿ“๐Ÿ“„๐Ÿ“ƒ๐Ÿ“‘๐Ÿ“Š๐Ÿ“ˆ๐Ÿ“‰๐Ÿ“œ๐Ÿ“‹๐Ÿ“…๐Ÿ“†๐Ÿ“‡๐Ÿ“๐Ÿ“‚โœ‚๏ธ๐Ÿ“Œ๐Ÿ“Žโœ’๏ธโœ๏ธ๐Ÿ“๐Ÿ“๐Ÿ“•๐Ÿ“—๐Ÿ“˜๐Ÿ“™๐Ÿ““๐Ÿ“”๐Ÿ“’๐Ÿ“š๐Ÿ“–๐Ÿ”–๐Ÿ“›๐Ÿ”ฌ๐Ÿ”ญ๐Ÿ“ฐ๐ŸŽจ๐ŸŽฌ๐ŸŽค๐ŸŽง๐ŸŽผ๐ŸŽต๐ŸŽถ๐ŸŽน๐ŸŽป๐ŸŽบ๐ŸŽท๐ŸŽธ๐Ÿ‘พ๐ŸŽฎ๐Ÿƒ๐ŸŽด๐Ÿ€„๏ธ๐ŸŽฒ๐ŸŽฏ๐Ÿˆ๐Ÿ€โšฝ๏ธโšพ๏ธ๐ŸŽพ๐ŸŽฑ๐Ÿ‰๐ŸŽณโ›ณ๏ธ๐Ÿšต๐Ÿšด๐Ÿ๐Ÿ‡๐Ÿ†๐ŸŽฟ๐Ÿ‚๐ŸŠ๐Ÿ„๐ŸŽฃโ˜•๏ธ๐Ÿต๐Ÿถ๐Ÿผ๐Ÿบ๐Ÿป๐Ÿธ๐Ÿน๐Ÿท๐Ÿด๐Ÿ•๐Ÿ”๐ŸŸ๐Ÿ—๐Ÿ–๐Ÿ๐Ÿ›๐Ÿค๐Ÿฑ๐Ÿฃ๐Ÿฅ๐Ÿ™๐Ÿ˜๐Ÿš๐Ÿœ๐Ÿฒ๐Ÿข๐Ÿก๐Ÿณ๐Ÿž๐Ÿฉ๐Ÿฎ๐Ÿฆ๐Ÿจ๐Ÿง๐ŸŽ‚๐Ÿฐ๐Ÿช๐Ÿซ๐Ÿฌ๐Ÿญ๐Ÿฏ๐ŸŽ๐Ÿ๐ŸŠ๐Ÿ‹๐Ÿ’๐Ÿ‡๐Ÿ‰๐Ÿ“๐Ÿ‘๐Ÿˆ๐ŸŒ๐Ÿ๐Ÿ๐Ÿ ๐Ÿ†๐Ÿ…๐ŸŒฝ๐Ÿ ๐Ÿก๐Ÿซ๐Ÿข๐Ÿฃ๐Ÿฅ๐Ÿฆ๐Ÿช๐Ÿฉ๐Ÿจ๐Ÿ’’โ›ช๏ธ๐Ÿฌ๐Ÿค๐ŸŒ‡๐ŸŒ†๐Ÿฏ๐Ÿฐโ›บ๏ธ๐Ÿญ๐Ÿ—ผ๐Ÿ—พ๐Ÿ—ป๐ŸŒ„๐ŸŒ…๐ŸŒƒ๐Ÿ—ฝ๐ŸŒ‰๐ŸŽ ๐ŸŽกโ›ฒ๏ธ๐ŸŽข๐Ÿšขโ›ต๏ธ๐Ÿšค๐Ÿšฃโš“๏ธ๐Ÿš€โœˆ๏ธ๐Ÿ’บ๐Ÿš๐Ÿš‚๐ŸšŠ๐Ÿš‰๐Ÿšž๐Ÿš†๐Ÿš„๐Ÿš…๐Ÿšˆ๐Ÿš‡๐Ÿš๐Ÿš‹๐Ÿšƒ๐ŸšŽ๐ŸšŒ๐Ÿš๐Ÿš™๐Ÿš˜๐Ÿš—๐Ÿš•๐Ÿš–๐Ÿš›๐Ÿšš๐Ÿšจ๐Ÿš“๐Ÿš”๐Ÿš’๐Ÿš‘๐Ÿš๐Ÿšฒ๐Ÿšก๐ŸšŸ๐Ÿš ๐Ÿšœ๐Ÿ’ˆ๐Ÿš๐ŸŽซ๐Ÿšฆ๐Ÿšฅโš ๏ธ๐Ÿšง๐Ÿ”ฐโ›ฝ๏ธ๐Ÿฎ๐ŸŽฐโ™จ๏ธ๐Ÿ—ฟ๐ŸŽช๐ŸŽญ๐Ÿ“๐Ÿšฉ๐Ÿ‡ฏ๐Ÿ‡ต๐Ÿ‡ฐ๐Ÿ‡ท๐Ÿ‡ฉ๐Ÿ‡ช๐Ÿ‡จ๐Ÿ‡ณ๐Ÿ‡บ๐Ÿ‡ธ๐Ÿ‡ซ๐Ÿ‡ท๐Ÿ‡ช๐Ÿ‡ธ๐Ÿ‡ฎ๐Ÿ‡น๐Ÿ‡ท๐Ÿ‡บ๐Ÿ‡ฌ๐Ÿ‡ง1โƒฃ2โƒฃ3โƒฃ4โƒฃ5โƒฃ6โƒฃ7โƒฃ8โƒฃ9โƒฃ0โƒฃ๐Ÿ”Ÿ๐Ÿ”ข#โƒฃ๐Ÿ”ฃโฌ†๏ธโฌ‡๏ธโฌ…๏ธโžก๏ธ๐Ÿ” ๐Ÿ”ก๐Ÿ”คโ†—๏ธโ†–๏ธโ†˜๏ธโ†™๏ธโ†”๏ธโ†•๏ธ๐Ÿ”„โ—€๏ธโ–ถ๏ธ๐Ÿ”ผ๐Ÿ”ฝโ†ฉ๏ธโ†ช๏ธโ„น๏ธโชโฉโซโฌโคต๏ธโคด๏ธ๐Ÿ†—๐Ÿ”€๐Ÿ”๐Ÿ”‚๐Ÿ†•๐Ÿ†™๐Ÿ†’๐Ÿ†“๐Ÿ†–๐Ÿ“ถ๐ŸŽฆ๐Ÿˆ๐Ÿˆฏ๏ธ๐Ÿˆณ๐Ÿˆต๐Ÿˆด๐Ÿˆฒ๐Ÿ‰๐Ÿˆน๐Ÿˆบ๐Ÿˆถ๐Ÿˆš๏ธ๐Ÿšป๐Ÿšน๐Ÿšบ๐Ÿšผ๐Ÿšพ๐Ÿšฐ๐Ÿšฎ๐Ÿ…ฟ๏ธโ™ฟ๏ธ๐Ÿšญ๐Ÿˆท๐Ÿˆธ๐Ÿˆ‚โ“‚๏ธ๐Ÿ›‚๐Ÿ›„๐Ÿ›…๐Ÿ›ƒ๐Ÿ‰‘ใŠ™๏ธใŠ—๏ธ๐Ÿ†‘๐Ÿ†˜๐Ÿ†”๐Ÿšซ๐Ÿ”ž๐Ÿ“ต๐Ÿšฏ๐Ÿšฑ๐Ÿšณ๐Ÿšท๐Ÿšธโ›”๏ธโœณ๏ธโ‡๏ธโŽโœ…โœด๏ธ๐Ÿ’Ÿ๐Ÿ†š๐Ÿ“ณ๐Ÿ“ด๐Ÿ…ฐ๐Ÿ…ฑ๐Ÿ†Ž๐Ÿ…พ๐Ÿ’ โžฟโ™ป๏ธโ™ˆ๏ธโ™‰๏ธโ™Š๏ธโ™‹๏ธโ™Œ๏ธโ™๏ธโ™Ž๏ธโ™๏ธโ™๏ธโ™‘๏ธโ™’๏ธโ™“๏ธโ›Ž๐Ÿ”ฏ๐Ÿง๐Ÿ’น๐Ÿ’ฒ๐Ÿ’ฑยฉยฎโ„ขโŒโ€ผ๏ธโ‰๏ธโ—๏ธโ“โ•โ”โญ•๏ธ๐Ÿ”๐Ÿ”š๐Ÿ”™๐Ÿ”›๐Ÿ”œ๐Ÿ”ƒ๐Ÿ•›๐Ÿ•ง๐Ÿ•๐Ÿ•œ๐Ÿ•‘๐Ÿ•๐Ÿ•’๐Ÿ•ž๐Ÿ•“๐Ÿ•Ÿ๐Ÿ•”๐Ÿ• ๐Ÿ••๐Ÿ•–๐Ÿ•—๐Ÿ•˜๐Ÿ•™๐Ÿ•š๐Ÿ•ก๐Ÿ•ข๐Ÿ•ฃ๐Ÿ•ค๐Ÿ•ฅ๐Ÿ•ฆโœ–๏ธโž•โž–โž—โ™ ๏ธโ™ฅ๏ธโ™ฃ๏ธโ™ฆ๏ธ๐Ÿ’ฎ๐Ÿ’ฏโœ”๏ธโ˜‘๏ธ๐Ÿ”˜๐Ÿ”—โžฐใ€ฐใ€ฝ๏ธ๐Ÿ”ฑโ—ผ๏ธโ—ป๏ธโ—พ๏ธโ—ฝ๏ธโ–ช๏ธโ–ซ๏ธ๐Ÿ”บ๐Ÿ”ฒ๐Ÿ”ณโšซ๏ธโšช๏ธ๐Ÿ”ด๐Ÿ”ต๐Ÿ”ปโฌœ๏ธโฌ›๏ธ๐Ÿ”ถ๐Ÿ”ท๐Ÿ”ธ๐Ÿ”น' + end + +end + +return { + description = "Sendet alle Emoticons", + usage = "/emoticons", + patterns = {"^/emoticons"}, + run = run +} diff --git a/plugins/eur.lua b/plugins/eur.lua deleted file mode 100644 index fe8250b..0000000 --- a/plugins/eur.lua +++ /dev/null @@ -1,35 +0,0 @@ -do - -function getEURUSD(usd) - local b = http.request("http://webrates.truefx.com/rates/connect.html?c=EUR/USD&f=csv&s=n") - local rates = b:split(", ") - local symbol = rates[1] - local timestamp = rates[2] - local sell = rates[3]..rates[4] - local buy = rates[5]..rates[6] - text = symbol..'\n'..'Buy: '..buy..'\n'..'Sell: '..sell - if usd then - eur = tonumber(usd) / tonumber(buy) - text = text.."\n "..usd.."USD = "..eur.."EUR" - end - return text -end - -function run(msg, matches) - if matches[1] == "!eur" then - return getEURUSD(nil) - end - return getEURUSD(matches[1]) -end - -return { - description = "EURUSD market value", - usage = "!eur [USD]", - patterns = { - "^!eur$", - "^!eur (%d+[%d%.]*)$", - }, - run = run -} - -end \ No newline at end of file diff --git a/plugins/facepalm.lua b/plugins/facepalm.lua new file mode 100644 index 0000000..a3b6c81 --- /dev/null +++ b/plugins/facepalm.lua @@ -0,0 +1,11 @@ +function run(msg, matches) + send_document(get_receiver(msg), "sticker/facepalm.webp", ok_cb, false) +end + +return { + description = "Facepalm", + usage = "/facepalm", + patterns = {"^/facepalm", + "^/Facepalm"}, + run = run +} \ No newline at end of file diff --git a/plugins/fortunes_uc3m.lua b/plugins/fortunes_uc3m.lua deleted file mode 100644 index 55e7a1b..0000000 --- a/plugins/fortunes_uc3m.lua +++ /dev/null @@ -1,24 +0,0 @@ -do - -function get_fortunes_uc3m() - local i = math.random(0,178) -- max 178 - local web = "http://www.gul.es/fortunes/f"..i - local b, c, h = http.request(web) - return b -end - - -function run(msg, matches) - return get_fortunes_uc3m() -end - -return { - description = "Fortunes from Universidad Carlos III", - usage = "!uc3m", - patterns = { - "^!uc3m$" - }, - run = run -} - -end \ No newline at end of file diff --git a/plugins/get.lua b/plugins/get.lua deleted file mode 100644 index c6873a8..0000000 --- a/plugins/get.lua +++ /dev/null @@ -1,94 +0,0 @@ -local _file_values = './data/values.lua' - -function read_file_values( ) - local f = io.open(_file_values, "r+") - -- If file doesn't exists - if f == nil then - -- Create a new empty table - print ('Created value file '.._file_values) - serialize_to_file({}, _file_values) - else - print ('Values loaded: '.._file_values) - f:close() - end - return loadfile (_file_values)() -end - -_values = read_file_values() - -function fetch_value(chat, value_name) - -- Chat non exists - if _values[chat] == nil then - return nil - end - - if value_name == nil then - return nil - end - - local value = _values[chat][value_name] - return value -end - -function get_value(chat, value_name) - - -- If chat values is empty - if (_values[chat] == nil) then - return "There isn't any data" - end - - -- If there is not value name, return all the values. - if (value_name == nil ) then - local text = "" - for key,value in pairs(_values[chat]) do - text = text..key.." = "..value.."\n" - end - return text - end - local value = _values[chat][value_name] - if ( value == nil) then - return "Can't find "..value_name - end - return value_name.." = "..value -end - -function run(msg, matches) - local chat_id = tostring(msg.to.id) - if matches[1] == "!get" then - return get_value(chat_id, nil) - end - return get_value(chat_id, matches[1]) -end - -function lex(msg) - - if msg.text then - local text = msg.text - local chat_id = tostring(msg.to.id) - local s, e = text:find("%$%a+") - - if s then - local var = text:sub(s + 1, e) - local value = fetch_value(chat_id, var) - - if (value == nil) then - value = "(unknown value " .. var .. ")" - end - - msg.text = text:sub(0, s - 1) .. value .. text:sub(e + 1) - end - end - - return msg -end - -return { - description = "Retrieves variables saved with !set", - usage = "!get (value_name): Returns the value_name value.", - patterns = { - "^!get (%a+)$", - "^!get$"}, - run = run, - pre_process = lex -} - diff --git a/plugins/giphy.lua b/plugins/giphy.lua index c474b59..9cc9fc0 100644 --- a/plugins/giphy.lua +++ b/plugins/giphy.lua @@ -49,25 +49,25 @@ function run(msg, matches) end if not gif_url then - return "Error: GIF not found" + return "Kein GIF gefunden!" end local receiver = get_receiver(msg) send_document_from_url(receiver, gif_url) - return "Preparing to make you laugh" + return "Einen Moment, GIF wird hochgeladen." end return { - description = "GIFs from telegram with Giphy API", + description = "Sucht und sendet ein GIF von Giphy", usage = { - "!gif (term): Search and sends GIF from Giphy. If no param, sends a trending GIF.", - "!giphy (term): Search and sends GIF from Giphy. If no param, sends a trending GIF." + "/gif (Begriff)", + "/giphy (Begriff)" }, patterns = { - "^!gif$", - "^!gif (.*)", - "^!giphy (.*)", - "^!giphy$" + "^/gif$", + "^/gif (.*)", + "^/giphy (.*)", + "^/giphy$" }, run = run } diff --git a/plugins/google.lua b/plugins/google.lua index 5e3434b..064b5ef 100644 --- a/plugins/google.lua +++ b/plugins/google.lua @@ -28,10 +28,10 @@ function run(msg, matches) end return { - description = "Searches Google and send results", - usage = "!google [terms]: Searches Google and send results", + description = "Durchsucht Google und sendet die ersten 5 Ergebnisse", + usage = "/google [Begriff]", patterns = { - "^!google (.*)$", + "^/google (.*)$", "^%.[g|G]oogle (.*)$" }, run = run diff --git a/plugins/gps.lua b/plugins/gps.lua deleted file mode 100644 index 1cc4347..0000000 --- a/plugins/gps.lua +++ /dev/null @@ -1,28 +0,0 @@ -do - -function run(msg, matches) - local lat = matches[1] - local lon = matches[2] - local receiver = get_receiver(msg) - - local zooms = {16, 18} - local urls = {} - for i = 1, #zooms do - local zoom = zooms[i] - local url = "http://maps.googleapis.com/maps/api/staticmap?zoom=" .. zoom .. "&size=600x300&maptype=roadmap¢er=" .. lat .. "," .. lon .. "&markers=color:blue%7Clabel:X%7C" .. lat .. "," .. lon - table.insert(urls, url) - end - - send_photos_from_url(receiver, urls) - - return "www.google.es/maps/place/@" .. lat .. "," .. lon -end - -return { - description = "generates a map showing the given GPS coordinates", - usage = "!gps latitude,longitude: generates a map showing the given GPS coordinates", - patterns = {"^!gps ([^,]*)[,%s]([^,]*)$"}, - run = run -} - -end \ No newline at end of file diff --git a/plugins/hackernews.lua b/plugins/hackernews.lua deleted file mode 100644 index 284a03f..0000000 --- a/plugins/hackernews.lua +++ /dev/null @@ -1,24 +0,0 @@ -do - -function run(msg, matches) - local result = 'Hacker News Top5:\n' - local top_stories_json, code = https.request('https://hacker-news.firebaseio.com/v0/topstories.json') - if code ~=200 then return nil end - local top_stories = json:decode(top_stories_json) - for i = 1, 5 do - local story_json, code = https.request('https://hacker-news.firebaseio.com/v0/item/'..top_stories[i]..'.json') - if code ~=200 then return nil end - local story = json:decode(story_json) - result = result .. i .. '. ' .. story.title .. ' - ' .. story.url .. '\n' - end - return result -end - -return { - description = "Show top 5 hacker news (ycombinator.com)", - usage = "!hackernews", - patterns = {"^!hackernews$"}, - run = run -} - -end diff --git a/plugins/hallo.lua b/plugins/hallo.lua new file mode 100644 index 0000000..24478c7 --- /dev/null +++ b/plugins/hallo.lua @@ -0,0 +1,15 @@ +function run(msg, matches) + local user_name = get_name(msg) + local receiver = get_receiver(msg) + return "Hallo " .. user_name .. "!" +end + +return { + description = "Sagt hallo zu euch", + usage = "hallo", + patterns = { + "^Hallo(.*)$", + "^hallo(.*)$" + }, + run = run +} diff --git a/plugins/hello.lua b/plugins/hello.lua deleted file mode 100644 index 706b3d1..0000000 --- a/plugins/hello.lua +++ /dev/null @@ -1,17 +0,0 @@ -do - -function run(msg, matches) - return "Hello, " .. matches[1] -end - -return { - description = "Says hello to someone", - usage = "say hello to [name]", - patterns = { - "^say hello to (.*)$", - "^Say hello to (.*)$" - }, - run = run -} - -end \ No newline at end of file diff --git a/plugins/help.lua b/plugins/help.lua index 247ea6c..2292f85 100644 --- a/plugins/help.lua +++ b/plugins/help.lua @@ -27,13 +27,13 @@ end -- !help command local function telegram_help() - local text = "Plugin list: \n\n" + local text = "Plugin Liste: \n\n" -- Plugins names for name in pairs(plugins) do text = text..name..'\n' end - text = text..'\n'..'Write "!help [plugin name]" for more info.' - text = text..'\n'..'Or "!help all" to show all info.' + text = text..'\n'..'Benutze "/hilfe [Plugin Name]" fรผr mehr Informationen' + text = text..'\n'..'Oder "/hilfe all" um alles zu sehen.' return text end @@ -47,9 +47,9 @@ local function help_all() end local function run(msg, matches) - if matches[1] == "!help" then + if matches[1] == "/hilfe" then return telegram_help() - elseif matches[1] == "!help all" then + elseif matches[1] == "/hilfe all" then return help_all() else local text = plugin_help(matches[1]) @@ -61,16 +61,12 @@ local function run(msg, matches) end return { - description = "Help plugin. Get info from other plugins. ", - usage = { - "!help: Show list of plugins.", - "!help all: Show all commands for every plugin.", - "!help [plugin name]: Commands for that plugin." - }, + description = "", + usage = {""}, patterns = { - "^!help$", - "^!help all", - "^!help (.+)" + "^/hilfe$", + "^/hilfe all", + "^/hilfe (.+)" }, run = run } diff --git a/plugins/imdb.lua b/plugins/imdb.lua deleted file mode 100644 index 8de189e..0000000 --- a/plugins/imdb.lua +++ /dev/null @@ -1,36 +0,0 @@ -do - -function imdb(movie) - local http = require("socket.http") - http.TIMEOUT = 5 - - 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 #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]) -end - -return { - description = "Imdb plugin for telegram", - usage = "!imdb [movie]", - patterns = {"^!imdb (.+)"}, - run = run -} - -end \ No newline at end of file diff --git a/plugins/img_google.lua b/plugins/img_google.lua index 3f2b7bd..365e1c6 100644 --- a/plugins/img_google.lua +++ b/plugins/img_google.lua @@ -2,7 +2,7 @@ do function getGoogleImage(text) local text = URL.escape(text) - local api = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&q=" + local api = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&safe=active&q=" local res, code = http.request(api..text) if code ~= 200 then return nil end local google = json:decode(res) @@ -12,7 +12,7 @@ function getGoogleImage(text) end local data = google.responseData - + if not data or not data.results then return nil end @@ -32,18 +32,18 @@ function run(msg, matches) local url = getGoogleImage(text) if not url then - return "Error: Image not found" + return "Kein Bild gefunden. Versuch es nochmal" end - print("Image URL: ", url) - send_photo_from_url(receiver, url) + print("Bilder-URL: ", url) + send_photo_from_url(receiver, url) end return { - description = "Search image with Google API and sends it.", - usage = "!img [term]: Random search an image with Google API.", - patterns = {"^!img (.*)$"}, - run = run + description = "Sucht Bild mit Google-API und versendet es (SafeSearch aktiv)", + usage = "/img [Suchbegriff]", + patterns = {"^/img (.*)$"}, + run = run } -end \ No newline at end of file +end diff --git a/plugins/img_google_nsfw.lua b/plugins/img_google_nsfw.lua new file mode 100644 index 0000000..989712d --- /dev/null +++ b/plugins/img_google_nsfw.lua @@ -0,0 +1,49 @@ +do + +function getGoogleImage(text) + local text = URL.escape(text) + local api = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&q=" + local res, code = http.request(api..text) + if code ~= 200 then return nil end + local google = json:decode(res) + + if google.responseStatus ~= 200 then + return nil + end + + local data = google.responseData + + if not data or not data.results then + return nil + end + + if #data.results == 0 then + return nil + end + + -- Random image from table + local i = math.random(#data.results) + return data.results[i].url +end + +function run(msg, matches) + local receiver = get_receiver(msg) + local text = matches[1] + local url = getGoogleImage(text) + + if not url then + return "Kein Bild gefunden. Versuch es nochmal" + end + + print("Bilder-URL: ", url) + send_photo_from_url(receiver, url) +end + +return { + description = "Sucht Bild mit Google-API und versendet es (SafeSearch aktiv)", + usage = "/img [Suchbegriff]", + patterns = {"^/img (.*)$"}, + run = run +} + +end diff --git a/plugins/invite.lua b/plugins/invite.lua deleted file mode 100644 index e4a22cb..0000000 --- a/plugins/invite.lua +++ /dev/null @@ -1,44 +0,0 @@ --- Invite other user to the chat group. --- Use !invite name User_name or !invite id id_number --- The User_name is the print_name (there are no spaces but _) - -do - -local function run(msg, matches) - -- User submitted a user name - if matches[1] == "name" then - user = matches[2] - user = string.gsub(user," ","_") - end - -- User submitted an id - if matches[1] == "id" then - user = matches[2] - user = 'user#id'..user - end - -- The message must come from a chat group - if msg.to.type == 'chat' then - chat = 'chat#id'..msg.to.id - else - return 'This isnt a chat group!' - end - print ("Trying to add: "..user.." to "..chat) - status = chat_add_user (chat, user, ok_cb, false) - if not status then - return "An error happened" - end - return "Added user: "..user.." to "..chat -end - -return { - description = "Invite other user to the chat group", - usage = { - "!invite name [user_name]", - "!invite id [user_id]" }, - patterns = { - "^!invite (name) (.*)$", - "^!invite (id) (%d+)$" - }, - run = run -} - -end \ No newline at end of file diff --git a/plugins/kitty.lua b/plugins/kitty.lua new file mode 100644 index 0000000..752c7b7 --- /dev/null +++ b/plugins/kitty.lua @@ -0,0 +1,22 @@ +function run(msg, matches) + + if string.starts(msg.text, '/kitty') then + randomValue = math.random(4) + if randomValue == 1 then + send_photo(get_receiver(msg), "pictures/cats/cat1.jpg", ok_cb, false) + elseif randomValue == 2 then + send_photo(get_receiver(msg), "pictures/cats/cat2.jpg", ok_cb, false) + elseif randomValue == 3 then + send_photo(get_receiver(msg), "pictures/cats/cat3.jpg", ok_cb, false) + elseif randomValue == 4 then + send_photo(get_receiver(msg), "pictures/cats/cat4.jpg", ok_cb, false) + end + end +end + +return { + description = "Sendet eins von 4 Katzenbilder", + usage = "/kitty", + patterns = {"^/kitty"}, + run = run +} \ No newline at end of file diff --git a/plugins/location.lua b/plugins/location.lua deleted file mode 100644 index 23663db..0000000 --- a/plugins/location.lua +++ /dev/null @@ -1,61 +0,0 @@ --- Implement a command !loc [area] which uses --- the static map API to get a location image - --- Not sure if this is the proper way --- Intent: get_latlong is in time.lua, we need it here --- loadfile "time.lua" - --- Globals --- If you have a google api key for the geocoding/timezone api -do - -local api_key = nil - -local base_api = "https://maps.googleapis.com/maps/api" - -function get_staticmap(area) - local api = base_api .. "/staticmap?" - - -- Get a sense of scale - local lat,lng,acc,types = get_latlong(area) - - local scale = types[1] - if scale=="locality" then zoom=8 - elseif scale=="country" then zoom=4 - else zoom = 13 end - - local parameters = - "size=600x300" .. - "&zoom=" .. zoom .. - "¢er=" .. URL.escape(area) .. - "&markers=color:red"..URL.escape("|"..area) - - if api_key ~=nil and api_key ~= "" then - parameters = parameters .. "&key="..api_key - end - return lat, lng, api..parameters -end - - -function run(msg, matches) - local receiver = get_receiver(msg) - local lat,lng,url = get_staticmap(matches[1]) - - -- Send the actual location, is a google maps link - send_location(receiver, lat, lng, ok_cb, false) - - -- Send a picture of the map, which takes scale into account - send_photo_from_url(receiver, url) - - -- Return a link to the google maps stuff is now not needed anymore - return nil -end - -return { - description = "Gets information about a location, maplink and overview", - usage = "!loc (location): Gets information about a location, maplink and overview", - patterns = {"^!loc (.*)$"}, - run = run -} - -end \ No newline at end of file diff --git a/plugins/lucky_star.lua b/plugins/lucky_star.lua new file mode 100644 index 0000000..1ceb930 --- /dev/null +++ b/plugins/lucky_star.lua @@ -0,0 +1,32 @@ +function run(msg, matches) + + if string.starts(msg.text, '/kagami') or string.starts(msg.text, "/Kagami") then + send_photo(get_receiver(msg), "pictures/luckystar/kagami.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/konata') or string.starts(msg.text, "/Konata") then + send_photo(get_receiver(msg), "pictures/luckystar/konata.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/miyuki') or string.starts(msg.text, "/Miyuki") then + send_photo(get_receiver(msg), "pictures/luckystar/miyuki.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/tsukasa') or string.starts(msg.text, "/Tsukasa") then + send_photo(get_receiver(msg), "pictures/luckystar/tsukasa.jpg", ok_cb, false) + end +end + +return { + description = "Sendet ein Bild von den Lucky Star Chars", + usage = "/kagami, /konata, /tsukasa oder /miyuki", + patterns = {"^/kagami", + "^/Kagami", + "^/konata", + "^/Konata", + "^/miyuki", + "^/Miyuki", + "^/tsukasa", + "^/Tsukasa"}, + run = run +} \ No newline at end of file diff --git a/plugins/magic8ball.lua b/plugins/magic8ball.lua deleted file mode 100644 index 7d62c71..0000000 --- a/plugins/magic8ball.lua +++ /dev/null @@ -1,22 +0,0 @@ -do - -function run(msg, matches) - local answers = {'It is certain','It is decidedly so','Without a doubt', - 'Yes definitely','You may rely on it','As I see it, yes', - 'Most likely','Outlook good','Yes','Signs point to yes', - 'Reply hazy try again','Ask again later', - 'Better not tell you now','Cannot predict now', - 'Concentrate and ask again','Don\'t count on it', - 'My reply is no','My sources say no','Outlook not so good', - 'Very doubtful'} - return answers[math.random(#answers)] -end - -return { - description = "Magic 8Ball", - usage = "!magic8ball", - patterns = {"^!magic8ball"}, - run = run -} - -end diff --git a/plugins/magische_miesmuschel.lua b/plugins/magische_miesmuschel.lua new file mode 100644 index 0000000..3cdec6e --- /dev/null +++ b/plugins/magische_miesmuschel.lua @@ -0,0 +1,20 @@ +do + +function run(msg, matches) + local answers = {'Ja','Nein','Eines Tages vielleicht'} + return answers[math.random(#answers)] +end + + +return { + description = "Beantwortet euch eine Frage (100% Wahrheit!)", + usage = "Magische Miesmuschel [Frage]", + patterns = { + "^Magische Miesmuschel(.*)$", + "^magische Miesmuschel(.*)$", + "^Magische miesmuschel(.*)$", + "^magische miesmuschel(.*)$" + }, + run = run +} +end \ No newline at end of file diff --git a/plugins/media.lua b/plugins/media.lua index 37070b6..f3367ac 100644 --- a/plugins/media.lua +++ b/plugins/media.lua @@ -1,6 +1,7 @@ do function run(msg, matches) + local receiver = get_receiver(msg) local file = download_to_file(matches[1]) send_document(get_receiver(msg), file, ok_cb, false) end @@ -18,9 +19,19 @@ return { "(https?://[%w-_%.%?%.:/%+=&]+%.rar)$", "(https?://[%w-_%.%?%.:/%+=&]+%.wmv)$", "(https?://[%w-_%.%?%.:/%+=&]+%.doc)$", - "(https?://[%w-_%.%?%.:/%+=&]+%.avi)$" + "(https?://[%w-_%.%?%.:/%+=&]+%.tar.gz)$", + "(https?://[%w-_%.%?%.:/%+=&]+%.dlc)$", + "(https?://[%w-_%.%?%.:/%+=&]+%.txt)$", + "(https?://[%w-_%.%?%.:/%+=&]+%.deb)$", + "(https?://[%w-_%.%?%.:/%+=&]+%.webm)$", + "(https?://[%w-_%.%?%.:/%+=&]+%.avi)$", + "(https?://[%w-_%.%?%.:/%+=&]+%.wav)$", + "(https?://[%w-_%.%?%.:/%+=&]+%.exe)$", + "(https?://[%w-_%.%?%.:/%+=&]+%.rpm)$", + "(https?://[%w-_%.%?%.:/%+=&]+%.dmg)$", + "(https?://[%w-_%.%?%.:/%+=&]+%.apk)$" }, run = run } -end +end \ No newline at end of file diff --git a/plugins/download_media.lua b/plugins/media_download.lua similarity index 99% rename from plugins/download_media.lua rename to plugins/media_download.lua index 75e983e..da462b3 100644 --- a/plugins/download_media.lua +++ b/plugins/media_download.lua @@ -1,3 +1,4 @@ + local function callback(extra, success, result) if success then print('File downloaded to:', result) @@ -41,4 +42,4 @@ return { '%[(audio)%]' }, pre_process = pre_process -} \ No newline at end of file +} diff --git a/plugins/moepse.lua b/plugins/moepse.lua new file mode 100644 index 0000000..463a178 --- /dev/null +++ b/plugins/moepse.lua @@ -0,0 +1,15 @@ + +function run(msg, matches) + return 'se' + end + +return { + description = "Mรถpse? Meepse?", + usage = "mรถp oder meep", + patterns = {"^mรถp", + "Mรถp", + "meep", + "Meep"}, + run = run +} + diff --git a/plugins/myid.lua b/plugins/myid.lua new file mode 100644 index 0000000..dff592a --- /dev/null +++ b/plugins/myid.lua @@ -0,0 +1,10 @@ +function run(msg, matches) + return tostring(msg.from.id) .. ' ' .. tostring(is_sudo(msg)) +end + +return { + description = 'Zeigt deine Telegram ID', + usage = '/myid', + patterns = {'^/myid$'}, + run = run +} diff --git a/plugins/naira_derp.lua b/plugins/naira_derp.lua new file mode 100644 index 0000000..2a4eabb --- /dev/null +++ b/plugins/naira_derp.lua @@ -0,0 +1,11 @@ +function run(msg, matches) + send_document(get_receiver(msg), "sticker/naira_derp.webp", ok_cb, false) +end + +return { + description = "Naira Derp", + usage = "/nairad", + patterns = {"^/nairad", + "^/Nairad"}, + run = run +} \ No newline at end of file diff --git a/plugins/nau.lua b/plugins/nau.lua new file mode 100644 index 0000000..e6e5309 --- /dev/null +++ b/plugins/nau.lua @@ -0,0 +1,13 @@ +function run(msg, matches) + + if string.starts(msg.text, "/nau") then + send_photo(get_receiver(msg), "pictures/nau.jpg", ok_cb, false) + end +end + +return { + description = "RTL Nau", + usage = "/nau", + patterns = {"^/nau"}, + run = run +} \ No newline at end of file diff --git a/plugins/neorame.lua b/plugins/neorame.lua new file mode 100644 index 0000000..e97dc2d --- /dev/null +++ b/plugins/neorame.lua @@ -0,0 +1,13 @@ +function run(msg, matches) + + if string.starts(msg.text, "/neorame") then + send_photo(get_receiver(msg), "pictures/neorame.jpg", ok_cb, false) + end +end + +return { + description = "NeoRame is best pony!", + usage = "/neorame", + patterns = {"^/neorame"}, + run = run +} \ No newline at end of file diff --git a/plugins/niissan.lua b/plugins/niissan.lua new file mode 100644 index 0000000..1d622ef --- /dev/null +++ b/plugins/niissan.lua @@ -0,0 +1,18 @@ +function run(msg, matches) + + if string.starts(msg.text, 'nii-san') or string.starts(msg.text, 'Nii-san') or string.starts(msg.text, 'Nissan') or string.starts(msg.text, 'nissan') then + send_photo(get_receiver(msg), "pictures/Nii-san.jpg", ok_cb, false) + end + +end + +return { + description = "Nii-san <3", + usage = "nii-san, Nii-san, nissan oder Nissan", + patterns = {"^nii-san", + "^Nii-san", + "^nissan", + "^Nissan"}, + run = run +} + diff --git a/plugins/nope.avi.lua b/plugins/nope.avi.lua new file mode 100644 index 0000000..f11fc71 --- /dev/null +++ b/plugins/nope.avi.lua @@ -0,0 +1,15 @@ + +function run(msg, matches) + if matches[1] == "nope.avi" then + return 'https://www.youtube.com/watch?v=gvdf5n-zI14' + end + +end + +return { + description = 'Sendet ein YouTube Video namens "nope.avi"', + usage = "nope.avi", + patterns = {"^nope.avi"}, + run = run +} + diff --git a/plugins/nyu.lua b/plugins/nyu.lua new file mode 100644 index 0000000..7e53612 --- /dev/null +++ b/plugins/nyu.lua @@ -0,0 +1,16 @@ +function run(msg, matches) + + if string.starts(msg.text, 'nyu') or string.starts(msg.text, 'Nyu') then + send_photo(get_receiver(msg), "pictures/nyu.jpg", ok_cb, false) + end + +end + +return { + description = "Nyu?", + usage = "nyu", + patterns = {"^nyu", + "^Nyu"}, + run = run +} + diff --git a/plugins/ping.lua b/plugins/ping.lua deleted file mode 100644 index 55b7b27..0000000 --- a/plugins/ping.lua +++ /dev/null @@ -1,28 +0,0 @@ -do - -local socket = require("socket") - -function cron() - -- Use yours desired web and id - local addr = "www.google.com" - local dest = "user#id"..our_id - -- Checks a TCP connexion - local connexion = socket.connect(addr, 80) - if not connexion then - local text = "ALERT: "..addr.." is offline" - print (text) - send_msg(dest, text, ok_cb, false) - else - connexion:close() - end -end - -return { - description = "If domain is offline, send msg to peer", - usage = "", - patterns = {}, - run = nil, - cron = cron -} - -end \ No newline at end of file diff --git a/plugins/plugins.lua b/plugins/plugins.lua index fc8f931..bbcdb0f 100644 --- a/plugins/plugins.lua +++ b/plugins/plugins.lua @@ -51,7 +51,7 @@ end local function enable_plugin( filename ) -- Check if plugin is enabled if plugin_enabled(filename) then - return 'Plugin '..filename..' is enabled' + return 'Plugin '..filename..' ist aktiviert!' end -- Checks if plugin exists if plugin_exists(filename) then @@ -61,19 +61,19 @@ local function enable_plugin( filename ) -- Reload the plugins return reload_plugins( ) else - return 'Plugin '..filename..' does not exists' + return 'Das Plugin '..filename..' exestiert nicht!' end end local function disable_plugin( name, chat ) -- Check if plugins exists if not plugin_exists(name) then - return 'Plugin '..name..' does not exists' + return 'Das Plugin '..name..' exestiert nicht!' end local k = plugin_enabled(name) -- Check if plugin is enabled if not k then - return 'Plugin '..name..' not enabled' + return 'Das Plugin '..name..' ist nicht aktiviert!' end -- Disable and reload table.remove(_config.enabled_plugins, k) @@ -83,7 +83,7 @@ end local function disable_plugin_on_chat(receiver, plugin) if not plugin_exists(plugin) then - return "Plugin doesn't exists" + return "Das Plugin exestiert nicht!" end if not _config.disabled_plugin_on_chat then @@ -97,7 +97,7 @@ local function disable_plugin_on_chat(receiver, plugin) _config.disabled_plugin_on_chat[receiver][plugin] = true save_config() - return 'Plugin '..plugin..' disabled on this chat' + return 'Das Plugin '..plugin..' ist hier nun deaktiviert!' end local function reenable_plugin_on_chat(receiver, plugin) @@ -110,16 +110,16 @@ local function reenable_plugin_on_chat(receiver, plugin) end if not _config.disabled_plugin_on_chat[receiver][plugin] then - return 'This plugin is not disabled' + return 'Dieses Plugin ist nicht deaktiviert!' end _config.disabled_plugin_on_chat[receiver][plugin] = false - return 'Plugin '..plugin..' is enabled again' + return 'Das Plugin '..plugin..' ist wieder aktiviert!' end local function run(msg, matches) -- Show the available plugins - if matches[1] == '!plugins' then + if matches[1] == '/plugins' then return list_plugins() end @@ -158,20 +158,15 @@ local function run(msg, matches) end return { - description = "Plugin to manage other plugins. Enable, disable or reload.", - usage = { - "!plugins: list all plugins.", - "!plugins enable [plugin]: enable plugin.", - "!plugins disable [plugin]: disable plugin.", - "!plugins disable [plugin] chat: disable plugin only this chat.", - "!plugins reload: reloads all plugins." }, + description = "", + usage = {""}, patterns = { - "^!plugins$", - "^!plugins? (enable) ([%w_%.%-]+)$", - "^!plugins? (disable) ([%w_%.%-]+)$", - "^!plugins? (disable) ([%w_%.%-]+) (chat)", - "^!plugins? (enable) ([%w_%.%-]+) (chat)", - "^!plugins? (reload)$" }, + "^/plugins$", + "^/plugins? (enable) ([%w_%.%-]+)$", + "^/plugins? (disable) ([%w_%.%-]+)$", + "^/plugins? (disable) ([%w_%.%-]+) (chat)", + "^/plugins? (enable) ([%w_%.%-]+) (chat)", + "^/plugins? (reload)$" }, run = run, privileged = true } diff --git a/plugins/quotes.lua b/plugins/quotes.lua deleted file mode 100644 index 93ab554..0000000 --- a/plugins/quotes.lua +++ /dev/null @@ -1,72 +0,0 @@ -local quotes_file = './data/quotes.lua' -local quotes_table - -function read_quotes_file() - local f = io.open(quotes_file, "r+") - - if f == nil then - print ('Created a new quotes file on '..quotes_file) - serialize_to_file({}, quotes_file) - else - print ('Quotes loaded: '..quotes_file) - f:close() - end - return loadfile (quotes_file)() -end - -function save_quote(msg) - local to_id = tostring(msg.to.id) - - if msg.text:sub(11):isempty() then - return "Usage: !addquote quote" - end - - if quotes_table == nil then - quotes_table = {} - end - - if quotes_table[to_id] == nil then - print ('New quote key to_id: '..to_id) - quotes_table[to_id] = {} - end - - local quotes = quotes_table[to_id] - quotes[#quotes+1] = msg.text:sub(11) - - serialize_to_file(quotes_table, quotes_file) - - return "done!" -end - -function get_quote(msg) - local to_id = tostring(msg.to.id) - local quotes_phrases - - quotes_table = read_quotes_file() - quotes_phrases = quotes_table[to_id] - - return quotes_phrases[math.random(1,#quotes_phrases)] -end - -function run(msg, matches) - if string.match(msg.text, "!quote$") then - return get_quote(msg) - elseif string.match(msg.text, "!addquote (.+)$") then - quotes_table = read_quotes_file() - return save_quote(msg) - end -end - -return { - description = "Save quote", - description = "Quote plugin, you can create and retrieves random quotes", - usage = { - "!addquote [msg]", - "!quote", - }, - patterns = { - "^!addquote (.+)$", - "^!quote$", - }, - run = run -} diff --git a/plugins/rae.lua b/plugins/rae.lua deleted file mode 100644 index 3c2c7f5..0000000 --- a/plugins/rae.lua +++ /dev/null @@ -1,65 +0,0 @@ -do - -function getDulcinea( text ) - -- Powered by https://github.com/javierhonduco/dulcinea - - local api = "http://dulcinea.herokuapp.com/api/?query=" - local query_url = api..text - - local b, code = http.request(query_url) - - if code ~= 200 then - return "Error: HTTP Connexion" - end - - dulcinea = json:decode(b) - - if dulcinea.status == "error" then - return "Error: " .. dulcinea.message - end - - while dulcinea.type == "multiple" do - text = dulcinea.response[1].id - b = http.request(api..text) - dulcinea = json:decode(b) - end - - local text = "" - - local responses = #dulcinea.response - - if responses == 0 then - return "Error: 404 word not found" - end - - if (responses > 5) then - responses = 5 - end - - for i = 1, responses, 1 do - text = text .. dulcinea.response[i].word .. "\n" - local meanings = #dulcinea.response[i].meanings - if (meanings > 5) then - meanings = 5 - end - for j = 1, meanings, 1 do - local meaning = dulcinea.response[i].meanings[j].meaning - text = text .. meaning .. "\n\n" - end - end - - return text -end - -function run(msg, matches) - return getDulcinea(matches[1]) -end - -return { - description = "Spanish dictionary", - usage = "!rae [word]: Search that word in Spanish dictionary.", - patterns = {"^!rae (.*)$"}, - run = run -} - -end \ No newline at end of file diff --git a/plugins/rich_bitch.lua b/plugins/rich_bitch.lua new file mode 100644 index 0000000..0abc371 --- /dev/null +++ b/plugins/rich_bitch.lua @@ -0,0 +1,19 @@ + +function run(msg, matches) + if matches[1] == "rich bitch" then + return 'Akamaru ist nicht reich!' + end + +end + +return { + description = "Sagt euch dass Akamaru nicht reich ist", + usage = "rich bitch", + patterns = {"^Rich Bitch", + "^rich bitch", + "^rich Bitch", + "^Rich bitch", + "^RICH BITCH"}, + run = run +} + diff --git a/plugins/sakurasou.lua b/plugins/sakurasou.lua new file mode 100644 index 0000000..8d05a4b --- /dev/null +++ b/plugins/sakurasou.lua @@ -0,0 +1,50 @@ +function run(msg, matches) + + if string.starts(msg.text, '/shiina') or string.starts(msg.text, "/Shiina") then + send_photo(get_receiver(msg), "pictures/sakurasou/shiina.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/chihiro') or string.starts(msg.text, "/Chihiro") then + send_photo(get_receiver(msg), "pictures/sakurasou/chihiro.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/jin') or string.starts(msg.text, "/Jin") then + send_photo(get_receiver(msg), "pictures/sakurasou/jin.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/misaki') or string.starts(msg.text, "/Misaki") then + send_photo(get_receiver(msg), "pictures/sakurasou/misaki.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/nanami') or string.starts(msg.text, "/Nanami") then + send_photo(get_receiver(msg), "pictures/sakurasou/nanami.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/ryuunosuke') or string.starts(msg.text, "/Ryuunosuke") then + send_photo(get_receiver(msg), "pictures/sakurasou/ryuunosuke.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/sorata') or string.starts(msg.text, "/Sorata") then + send_photo(get_receiver(msg), "pictures/sakurasou/sorata.jpg", ok_cb, false) + end +end + +return { + description = "", + usage = "", + patterns = {"^/shiina", + "^/Shiina", + "^/chihiro", + "^/Chihiro", + "^/jin", + "^/Jin", + "^/misaki", + "^/Misaki", + "^/nanami", + "^/Nanami", + "^/ryuunosuke", + "^/Ryuunosuke", + "^/sorata", + "^/Sorata"}, + run = run +} \ No newline at end of file diff --git a/plugins/search_youtube.lua b/plugins/search_youtube.lua index 909c456..94df62f 100644 --- a/plugins/search_youtube.lua +++ b/plugins/search_youtube.lua @@ -29,7 +29,7 @@ local function searchYoutubeVideo(text) print("HTTP Error") return nil elseif not data.feed.entry then - return "YouTube video not found!" + return "Kein YouTube Video gefunden!" end return data.feed.entry[1].link[1].href end @@ -43,10 +43,10 @@ local function run(msg, matches) end return { - description = "Search video on youtube and send it.", - usage = "!youtube [term]: Search for a youtube video and send it.", + description = "Sucht ein Video auf YouTube und sendet es", + usage = "/youtube [Begriff]", patterns = { - "^!youtube (.*)" + "^/youtube (.*)" }, run = run } diff --git a/plugins/senran_kagura.lua b/plugins/senran_kagura.lua new file mode 100644 index 0000000..551a806 --- /dev/null +++ b/plugins/senran_kagura.lua @@ -0,0 +1,69 @@ +function run(msg, matches) + + if string.starts(msg.text, '/asuka') or string.starts(msg.text, "/Asuka") then + send_photo(get_receiver(msg), "pictures/senrankagura/hanzouacademy/asuka.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/hibari') or string.starts(msg.text, "/Hibari") then + send_photo(get_receiver(msg), "pictures/senrankagura/hanzouacademy/hibari.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/ikaruga') or string.starts(msg.text, "/Ikaruga") then + send_photo(get_receiver(msg), "pictures/senrankagura/hanzouacademy/ikaruga.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/katsuragi') or string.starts(msg.text, "/Katsuragi") then + send_photo(get_receiver(msg), "pictures/senrankagura/hanzouacademy/katsuragi.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/yagyuu') or string.starts(msg.text, "/Yagyuu") then + send_photo(get_receiver(msg), "pictures/senrankagura/hanzouacademy/yagyuu.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/haruka') or string.starts(msg.text, "/Haruka") then + send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/haruka.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/hikage') or string.starts(msg.text, "/Hikage") then + send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/hikage.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/homura') or string.starts(msg.text, "/Homura") then + send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/homura.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/mirai') or string.starts(msg.text, "/Mirai") then + send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/mirai.jpg", ok_cb, false) + end + + if string.starts(msg.text, '/yomi') or string.starts(msg.text, "/Yomi") then + send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/yomi.jpg", ok_cb, false) + end +end + +return { + description = "", + usage = "", + patterns = {"^/asuka", + "^/Asuka", + "^/hibari", + "^/Hibari", + "^/ikaruga", + "^/Ikaruga", + "^/katsuragi", + "^/Katsuragi", + "^/yagyuu", + "^/Yagyuu", + "^/haruka", + "^/Haruka", + "^/hikage", + "^/Hikage", + "^/homura", + "^/Homura", + "^/mirai", + "^/Mirai", + "^/yomi", + "^/Yomi"}, + run = run +} + diff --git a/plugins/set.lua b/plugins/set.lua deleted file mode 100644 index 8f0b1a6..0000000 --- a/plugins/set.lua +++ /dev/null @@ -1,31 +0,0 @@ -local _file_values = './data/values.lua' - -function save_value(chat, text ) - var_name, var_value = string.match(text, "!set (%a+) (.+)") - if (var_name == nil or var_value == nil) then - return "Usage: !set var_name value" - end - if _values[chat] == nil then - _values[chat] = {} - end - _values[chat][var_name] = var_value - - -- Save values to file - serialize_to_file(_values, _file_values) - - return "Saved "..var_name.." = "..var_value -end - -function run(msg, matches) - local chat_id = tostring(msg.to.id) - local text = save_value(chat_id, msg.text) - return text -end - -return { - description = "Plugin for saving values. get.lua plugin is necesary to retrieve them.", - usage = "!set [value_name] [data]: Saves the data with the value_name name.", - patterns = {"^!set (%a+) (.+)$"}, - run = run -} - diff --git a/plugins/sh.lua b/plugins/sh.lua new file mode 100644 index 0000000..42c283b --- /dev/null +++ b/plugins/sh.lua @@ -0,0 +1,38 @@ +function run_sh(msg) + name = get_name(msg) + text = '' + bash = msg.text:sub(4,-1) + text = run_bash(bash) + return text +end + +function run_bash(str) + local cmd = io.popen(str) + local result = cmd:read('*all') + cmd:close() + return result +end + +function run(msg, matches) + local receiver = get_receiver(msg) + if string.starts(msg.text, '/sh') then + text = run_sh(msg) + send_msg(receiver, text, ok_cb, false) + return + end + + if string.starts(msg.text, '/uptime') then + text = run_bash('uptime') + send_msg(receiver, text, ok_cb, false) + return + end + +end + +return { + description = "Fรผhrt Befehle in der Konsole aus", + usage = "", + patterns = {"^/uptime", "^/sh (.*)$"}, + run = run, + privileged = true +} \ No newline at end of file diff --git a/plugins/stats.lua b/plugins/stats.lua index 6d62356..cc1385d 100644 --- a/plugins/stats.lua +++ b/plugins/stats.lua @@ -104,10 +104,10 @@ end _stats = read_file_stats() return { - description = "Plugin to update user stats.", - usage = "!stats: Returns a list of Username [telegram_id]: msg_num", + description = "", + usage = "", patterns = { - "^!(stats)", + "^/(stats)", ".*" }, run = run, diff --git a/plugins/steam.lua b/plugins/steam.lua index 8c6a237..af4c9a8 100644 --- a/plugins/steam.lua +++ b/plugins/steam.lua @@ -1,3 +1,4 @@ + -- See https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI do @@ -28,8 +29,8 @@ end function send_steam_data(data, receiver) local description = string.sub(unescape(data.about_the_game:gsub("%b<>", "")), 1, DESC_LENTH) .. '...' local title = data.name - local price = "$"..(data.price_overview.initial/100) - local sale_price = "$"..(data.price_overview.final/100) + local price = "โ‚ฌ"..(data.price_overview.initial/100) + local sale_price = "โ‚ฌ"..(data.price_overview.final/100) local percent_savings = data.price_overview.discount_percent local price_display = price diff --git a/plugins/stille.lua b/plugins/stille.lua new file mode 100644 index 0000000..ac7d839 --- /dev/null +++ b/plugins/stille.lua @@ -0,0 +1,21 @@ +do + +function run(msg, matches) + local answers = {'Ja, es ist sehr ruhig hier','Wenn es dir zu still ist, kannst du gerne mit mir reden','*SCHREI*', + 'Dann mach doch etwas dagegen!','Mรถpse?','Vermutlich schlafen alle', + 'Stรถrt dich die Stille?','Nein, es ist nicht still','Nyu?', + 'Besser als Spam','Stille ist schรถn', + 'Mein Name ist Mikubot','Spiel doch etwas http://curvefever.com/', + 'Stille sagt manchmal mehr als tausend Worte','Stille und Nacht sind untrennbar verwoben. Die Nacht ist die Stille unter den Sternen.'} + return answers[math.random(#answers)] +end + +return { + description = "Es ist so still hier", + usage = "stille", + patterns = {"^Stille", + "^stille"}, + run = run +} + +end diff --git a/plugins/time.lua b/plugins/time.lua deleted file mode 100644 index 3ff6db6..0000000 --- a/plugins/time.lua +++ /dev/null @@ -1,100 +0,0 @@ --- Implement a command !time [area] which uses --- 2 Google APIs to get the desired result: --- 1. Geocoding to get from area to a lat/long pair --- 2. Timezone to get the local time in that lat/long location - --- Globals --- If you have a google api key for the geocoding/timezone api -api_key = nil - -base_api = "https://maps.googleapis.com/maps/api" -dateFormat = "%A %d %B - %H:%M:%S" - --- Need the utc time for the google api -function utctime() - return os.time(os.date("!*t")) -end - --- Use the geocoding api to get the lattitude and longitude with accuracy specifier --- CHECKME: this seems to work without a key?? -function get_latlong(area) - local api = base_api .. "/geocode/json?" - local parameters = "address=".. (URL.escape(area) or "") - if api_key ~= nil then - parameters = parameters .. "&key="..api_key - end - - -- Do the request - local res, code = https.request(api..parameters) - if code ~=200 then return nil end - local data = json:decode(res) - - if (data.status == "ZERO_RESULTS") then - return nil - end - if (data.status == "OK") then - -- Get the data - lat = data.results[1].geometry.location.lat - lng = data.results[1].geometry.location.lng - acc = data.results[1].geometry.location_type - types= data.results[1].types - return lat,lng,acc,types - end -end - --- Use timezone api to get the time in the lat, --- Note: this needs an API key -function get_time(lat,lng) - local api = base_api .. "/timezone/json?" - - -- Get a timestamp (server time is relevant here) - local timestamp = utctime() - local parameters = "location=" .. - URL.escape(lat) .. "," .. - URL.escape(lng) .. - "×tamp="..URL.escape(timestamp) - if api_key ~=nil then - parameters = parameters .. "&key="..api_key - end - - local res,code = https.request(api..parameters) - if code ~= 200 then return nil end - local data = json:decode(res) - - if (data.status == "ZERO_RESULTS") then - return nil - end - if (data.status == "OK") then - -- Construct what we want - -- The local time in the location is: - -- timestamp + rawOffset + dstOffset - local localTime = timestamp + data.rawOffset + data.dstOffset - return localTime, data.timeZoneId - end - return localTime -end - -function getformattedLocalTime(area) - if area == nil then - return "The time in nowhere is never" - end - - lat,lng,acc = get_latlong(area) - if lat == nil and lng == nil then - return 'It seems that in "'..area..'" they do not have a concept of time.' - end - local localTime, timeZoneId = get_time(lat,lng) - - return "The local time in "..timeZoneId.." is: ".. os.date(dateFormat,localTime) -end - -function run(msg, matches) - return getformattedLocalTime(matches[1]) -end - -return { - description = "Displays the local time in an area", - usage = "!time [area]: Displays the local time in that area", - patterns = {"^!time (.*)$"}, - run = run -} diff --git a/plugins/translate.lua b/plugins/translate.lua deleted file mode 100644 index 3ffff31..0000000 --- a/plugins/translate.lua +++ /dev/null @@ -1,81 +0,0 @@ - ---[[ --- Translate text using Google Translate. --- http://translate.google.com/translate_a/t?client=z&ie=UTF-8&oe=UTF-8&hl=en&tl=en&text=hello ---]] -do - -function translate(source_lang, target_lang, text) - local path = "http://translate.google.com/translate_a/t" - -- URL query parameters - local params = { - client = "z", -- JSON - ie = "UTF-8", - oe = "UTF-8", - hl = "en", - tl = target_lang or "en", - sl = source_lang or "", - text = URL.escape(text) - } - - local query = format_http_params(params, true) - local url = path..query - - local res, code = https.request(url) - -- Return nil if error - if code > 200 then return nil end - - local trans = json:decode(res) - - local sentences = "" - -- Join multiple sencentes - for k,sentence in pairs(trans.sentences) do - sentences = sentences..sentence.trans..'\n' - end - - return sentences -end - -function run(msg, matches) - -- Third pattern - if #matches == 1 then - print("First") - local text = matches[1] - return translate(nil, nil, text) - end - - -- Second pattern - if #matches == 2 then - print("Second") - local target = matches[1] - local text = matches[2] - return translate(nil, target, text) - end - - -- Frist pattern - if #matches == 3 then - print("Third") - local source = matches[1] - local target = matches[2] - local text = matches[3] - return translate(source, target, text) - end - -end - -return { - description = "Translate some text", - usage = { - "!translate text. Translate to english the text.", - "!translate target_lang text.", - "!translate source,target text", - }, - patterns = { - "^!translate ([%w]+),([%a]+) (.+)", - "^!translate ([%w]+) (.+)", - "^!translate (.+)", - }, - run = run -} - -end \ No newline at end of file diff --git a/plugins/twitter.lua b/plugins/twitter.lua deleted file mode 100644 index 36cebf1..0000000 --- a/plugins/twitter.lua +++ /dev/null @@ -1,74 +0,0 @@ -local OAuth = require "OAuth" - -local consumer_key = "" -local consumer_secret = "" -local access_token = "" -local access_token_secret = "" - -local client = OAuth.new(consumer_key, consumer_secret, { - RequestToken = "https://api.twitter.com/oauth/request_token", - AuthorizeUser = {"https://api.twitter.com/oauth/authorize", method = "GET"}, - AccessToken = "https://api.twitter.com/oauth/access_token" -}, { - OAuthToken = access_token, - OAuthTokenSecret = access_token_secret -}) - -function run(msg, matches) - - if consumer_key:isempty() then - return "Twitter Consumer Key is empty, write it in plugins/twitter.lua" - end - if consumer_secret:isempty() then - return "Twitter Consumer Secret is empty, write it in plugins/twitter.lua" - end - if access_token:isempty() then - return "Twitter Access Token is empty, write it in plugins/twitter.lua" - end - if access_token_secret:isempty() then - return "Twitter Access Token Secret is empty, write it in plugins/twitter.lua" - end - - local twitter_url = "https://api.twitter.com/1.1/statuses/show/" .. matches[1] .. ".json" - local response_code, response_headers, response_status_line, response_body = client:PerformRequest("GET", twitter_url) - local response = json:decode(response_body) - - local header = "Tweet from " .. response.user.name .. " (@" .. response.user.screen_name .. ")\n" - local text = response.text - - -- replace short URLs - if response.entities.url then - for k, v in pairs(response.entities.urls) do - local short = v.url - local long = v.expanded_url - text = text:gsub(short, long) - end - end - - -- remove images - local images = {} - if response.extended_entities and response.extended_entities.media then - for k, v in pairs(response.extended_entities.media) do - local url = v.url - local pic = v.media_url - text = text:gsub(url, "") - table.insert(images, pic) - end - end - - -- send the parts - local receiver = get_receiver(msg) - send_msg(receiver, header .. "\n" .. text, ok_cb, false) - send_photos_from_url(receiver, images) - return nil -end - - -return { - description = "When user sends twitter URL, send text and images to origin. Requieres OAuth Key.", - usage = "", - patterns = { - "https://twitter.com/[^/]+/status/([0-9]+)" - }, - run = run -} diff --git a/plugins/twitter_send.lua b/plugins/twitter_send.lua deleted file mode 100644 index 5ae4f7c..0000000 --- a/plugins/twitter_send.lua +++ /dev/null @@ -1,54 +0,0 @@ -do - -local OAuth = require "OAuth" - -local consumer_key = "" -local consumer_secret = "" -local access_token = "" -local access_token_secret = "" - -local client = OAuth.new(consumer_key, consumer_secret, { - RequestToken = "https://api.twitter.com/oauth/request_token", - AuthorizeUser = {"https://api.twitter.com/oauth/authorize", method = "GET"}, - AccessToken = "https://api.twitter.com/oauth/access_token" - }, { - OAuthToken = access_token, - OAuthTokenSecret = access_token_secret -}) - -function run(msg, matches) - if consumer_key:isempty() then - return "Twitter Consumer Key is empty, write it in plugins/twitter_send.lua" - end - if consumer_secret:isempty() then - return "Twitter Consumer Secret is empty, write it in plugins/twitter_send.lua" - end - if access_token:isempty() then - return "Twitter Access Token is empty, write it in plugins/twitter_send.lua" - end - if access_token_secret:isempty() then - return "Twitter Access Token Secret is empty, write it in plugins/twitter_send.lua" - end - - if not is_sudo(msg) then - return "You aren't allowed to send tweets" - end - - local response_code, response_headers, response_status_line, response_body = - client:PerformRequest("POST", "https://api.twitter.com/1.1/statuses/update.json", { - status = matches[1] - }) - if response_code ~= 200 then - return "Error: "..response_code - end - return "Tweet sended" -end - -return { - description = "Sends a tweet", - usage = "!tw [text]: Sends the Tweet with the configured accout.", - patterns = {"^!tw (.+)"}, - run = run -} - -end \ No newline at end of file diff --git a/plugins/url_title.lua b/plugins/url_title.lua new file mode 100644 index 0000000..785680e --- /dev/null +++ b/plugins/url_title.lua @@ -0,0 +1,47 @@ +do + +function getTitle(page) + local s = page + + -- Remove optional spaces from the tags. + s = string.gsub(s, "\n", " ") + s = string.gsub(s, " *< *", "<") + s = string.gsub(s, " *> *", ">") + + -- Put all the tags in lowercase. + s = string.gsub(s, "(<[^ >]+)", string.lower) + + local i, f, t = string.find(s, "(.+)") + return t or "" +end + +function string.ends(str, fin) + return fin=='' or string.sub(str,-string.len(fin)) == fin +end + +function run(msg, matches) + local url = matches[1] + if string.ends(url, ".jpg") or string.ends(url, ".gif") or string.ends(url, ".png") then + return + end + local result = http.request(url) + local title = getTitle(result) + + -- We don't want 301 (and one Extrawurst for Google), 302, 404 and empty titles + if title == "301 Moved Permanently" or title == "" or title == "404 Not Found" or title == "302 Found" or title == "Moved Permanently" then + print('Invalide, da "'..title..'"') + else + return title + end + end + +return { + description = "Postet URL-Titel", + usage = "", + patterns = { + "(https?://[%w-_%.%?%.:/%+=&]+)$", + }, + run = run +} + +end \ No newline at end of file diff --git a/plugins/version.lua b/plugins/version.lua index eeb7833..97de8dd 100644 --- a/plugins/version.lua +++ b/plugins/version.lua @@ -1,16 +1,14 @@ do function run(msg, matches) - return 'Telegram Bot '.. VERSION .. [[ - Checkout http://git.io/6jdjGg - GNU GPL v2 license.]] + return 'Mikubot '.. VERSION ..' by Akamaru' end return { - description = "Shows bot version", - usage = "!version: Shows bot version", + description = "Zeigt die Bot Version", + usage = "/version", patterns = { - "^!version$" + "^/version$" }, run = run } diff --git a/plugins/vote.lua b/plugins/vote.lua deleted file mode 100644 index bd5ffe3..0000000 --- a/plugins/vote.lua +++ /dev/null @@ -1,88 +0,0 @@ -do - -local _file_votes = './data/votes.lua' - -function read_file_votes () - local f = io.open(_file_votes, "r+") - if f == nil then - print ('Created voting file '.._file_votes) - serialize_to_file({}, _file_votes) - else - print ('Values loaded: '.._file_votes) - f:close() - end - return loadfile (_file_votes)() -end - -function clear_votes (chat) - local _votes = read_file_votes () - _votes [chat] = {} - serialize_to_file(_votes, _file_votes) -end - -function votes_result (chat) - local _votes = read_file_votes () - local results = {} - local result_string = "" - if _votes [chat] == nil then - _votes[chat] = {} - end - for user,vote in pairs (_votes[chat]) do - if (results [vote] == nil) then - results [vote] = user - else - results [vote] = results [vote] .. ", " .. user - end - end - for vote,users in pairs (results) do - result_string = result_string .. vote .. " : " .. users .. "\n" - end - return result_string -end - - -function save_vote(chat, user, vote) - local _votes = read_file_votes () - if _votes[chat] == nil then - _votes[chat] = {} - end - _votes[chat][user] = vote - - serialize_to_file(_votes, _file_votes) - -end - -function run(msg, matches) - if (matches[1] == "ing") then - if (matches [2] == "reset") then - clear_votes (tostring(msg.to.id)) - return "Voting statistics reset.." - elseif (matches [2] == "stats") then - local votes_result = votes_result (tostring(msg.to.id)) - if (votes_result == "") then - votes_result = "[No votes registered]\n" - end - return "Voting statistics :\n" .. votes_result - end - else - save_vote(tostring(msg.to.id), msg.from.print_name, tostring(tonumber(matches[2]))) - return "Vote registered : " .. msg.from.print_name .. " " .. tostring(tonumber(matches [2])) - end -end - -return { - description = "Plugin for voting in groups.", - usage = { - "!voting reset: Reset all the votes.", - "!vote [number]: Cast the vote.", - "!voting stats: Shows the statistics of voting." - }, - patterns = { - "^!vot(ing) (reset)", - "^!vot(ing) (stats)", - "^!vot(e) ([0-9]+)$" - }, - run = run -} - -end \ No newline at end of file diff --git a/plugins/wd.lua b/plugins/wd.lua new file mode 100644 index 0000000..fa2f6fe --- /dev/null +++ b/plugins/wd.lua @@ -0,0 +1,13 @@ +function run(msg, matches) + local user_name = get_name(msg) + return "" .. user_name .. " ist wieder da" +end + +return { + description = "Sagt dass ihr wieder da seid", + usage = "/wd", + patterns = { + "^/wd(.*)$" + }, + run = run +} diff --git a/plugins/weather.lua b/plugins/weather.lua deleted file mode 100644 index 50b526b..0000000 --- a/plugins/weather.lua +++ /dev/null @@ -1,45 +0,0 @@ -do - -local BASE_URL = "http://api.openweathermap.org/data/2.5" - -function get_weather(location) - print("Finding weather in ", location) - local b, c, h = http.request(BASE_URL.."/weather?q=" .. location .. "&units=metric") - local weather = json:decode(b) - print("Weather returns", weather) - local city = weather.name - local country = weather.sys.country - local temp = 'The temperature in ' .. city .. ' (' .. country .. ')' - temp = temp .. ' is ' .. weather.main.temp .. 'ยฐC' - conditions = 'Current conditions are: ' .. weather.weather[1].description - - if weather.weather[1].main == 'Clear' then - conditions = conditions .. ' โ˜€' - elseif weather.weather[1].main == 'Clouds' then - conditions = conditions .. ' โ˜โ˜' - elseif weather.weather[1].main == 'Rain' then - conditions = conditions .. ' โ˜”' - elseif weather.weather[1].main == 'Thunderstorm' then - conditions = conditions .. ' โ˜”โ˜”โ˜”โ˜”' - end - - return temp .. '\n' .. conditions -end - -function run(msg, matches) - if string.len(matches[1]) > 2 then - city = matches[1] - else - city = "Madrid,ES" - end - return get_weather(city) -end - -return { - description = "weather in that city (Madrid is default)", - usage = "!weather (city)", - patterns = {"^!weather(.*)$"}, - run = run -} - -end \ No newline at end of file diff --git a/plugins/wuerfel.lua b/plugins/wuerfel.lua new file mode 100644 index 0000000..81ef5be --- /dev/null +++ b/plugins/wuerfel.lua @@ -0,0 +1,13 @@ +do + +function run(msg, matches) + local answers = {'1','2','3','4','5','6'} + return answers[math.random(#answers)] +end +return { + description = "Wรผrfel eine Zahl zwischen 1 bis 6", + usage = "/wรผrfel", + patterns = {"^/wรผrfel"}, + run = run +} +end \ No newline at end of file diff --git a/plugins/xkcd.lua b/plugins/xkcd.lua index 37b23a3..1bfe157 100644 --- a/plugins/xkcd.lua +++ b/plugins/xkcd.lua @@ -34,7 +34,7 @@ end function run(msg, matches) local receiver = get_receiver(msg) - if matches[1] == "!xkcd" then + if matches[1] == "/xkcd" then url, title, alt = get_xkcd_random() else url, title, alt = get_xkcd(matches[1]) @@ -45,11 +45,11 @@ function run(msg, matches) end return { - description = "Send comic images from xkcd", - usage = {"!xkcd (id): Send an xkcd image and title. If not id, send a random one"}, + description = "Sendet Comics von xkcd", + usage = {"/xkcd"}, patterns = { - "^!xkcd$", - "^!xkcd (%d+)", + "^/xkcd$", + "^/xkcd (%d+)", "xkcd.com/(%d+)" }, run = run diff --git a/plugins/yolo.lua b/plugins/yolo.lua new file mode 100644 index 0000000..0a1bc5f --- /dev/null +++ b/plugins/yolo.lua @@ -0,0 +1,15 @@ + +function run(msg, matches) + if matches[1] == "yolo" then + return 'Hรค YOLO?' + end + +end + +return { + description = "Sendet euch ein Hรค YOLO?", + usage = "/yolo", + patterns = {"^/(yolo)"}, + run = run +} + diff --git a/plugins/youtube.lua b/plugins/youtube.lua deleted file mode 100644 index 47f7a9d..0000000 --- a/plugins/youtube.lua +++ /dev/null @@ -1,43 +0,0 @@ -do - -local BASE_URL = 'http://gdata.youtube.com/feeds/api/' - -function get_yt_data (yt_code) - local url = BASE_URL..'/videos/'..yt_code..'?v=2&alt=jsonc' - local res,code = http.request(url) - if code ~= 200 then return "HTTP ERROR" end - local data = json:decode(res).data - return data -end - -function send_youtube_data(data, receiver) - local title = data.title - local description = data.description - local uploader = data.uploader - local text = title..' ('..uploader..')\n'..description - local image_url = data.thumbnail.hqDefault - local cb_extra = { - receiver = receiver, - url = image_url - } - send_msg(receiver, text, send_photo_from_url_callback, cb_extra) -end - -function run(msg, matches) - local yt_code = matches[1] - local data = get_yt_data(yt_code) - local receiver = get_receiver(msg) - send_youtube_data(data, receiver) -end - -return { - description = "Sends YouTube info and image.", - usage = "", - patterns = { - "youtu.be/([_A-Za-z0-9-]+)", - "youtube.com/watch%?v=([_A-Za-z0-9-]+)", - }, - run = run -} - -end diff --git a/sticker/facepalm.webp b/sticker/facepalm.webp new file mode 100644 index 0000000..c4a4513 Binary files /dev/null and b/sticker/facepalm.webp differ diff --git a/sticker/naira_derp.webp b/sticker/naira_derp.webp new file mode 100644 index 0000000..9818308 Binary files /dev/null and b/sticker/naira_derp.webp differ