many code cleanup in plugins

This commit is contained in:
Akamaru 2015-04-20 18:52:25 +02:00
parent 1c93a20e11
commit 4021a1c84d
39 changed files with 133 additions and 150 deletions

View File

@ -1,13 +1,13 @@
function run(msg, matches)
--get username
local user_name = get_name(msg)
return "" .. user_name .. " ist nun AFK"
return '' .. user_name .. ' ist nun AFK'
end
return {
description = "Sagt dass ihr afk seid",
usage = "/afk",
patterns = {
"^/afk(.*)$"
},
patterns = {"^/afk(.*)$"},
run = run
}
--by Akamaru

View File

@ -1,9 +1,6 @@
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",
@ -11,3 +8,4 @@ return {
patterns = {"^aha.png"},
run = run
}
--by Akamaru

View File

@ -4,8 +4,8 @@ function run(msg, matches)
end
return {
description = "",
usage = "",
description = "So ein dummer Bot",
usage = "Baka Bot",
patterns = {"^baka bot",
"Baka bot",
"baka Bot",
@ -13,3 +13,4 @@ return {
"BAKA BOT"},
run = run
}
--by Akamaru

View File

@ -1,9 +1,6 @@
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!",
@ -13,3 +10,4 @@ return {
"^/Balsamiko Essig"},
run = run
}
--by Akamaru

View File

@ -16,7 +16,7 @@ function cron()
end
return {
description = "",
description = "Checkt ob Boerse.to online ist",
usage = "",
patterns = {},
run = nil,

View File

@ -14,7 +14,7 @@ function run(msg, matches)
end
return {
description = "get chuck norris joke",
description = "Sendet Chuck Norris Witze (Englisch)",
usage = "/cn",
patterns = {"^/cn$"},
run = run

View File

@ -1,14 +1,13 @@
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"},
patterns = {"^/emoticons",
"^/Emoticons"},
run = run
}
--by Akamaru

View File

@ -9,3 +9,4 @@ return {
"^/Facepalm"},
run = run
}
--by Akamaru

View File

@ -13,3 +13,4 @@ return {
},
run = run
}
--by Akamaru

View File

@ -7,8 +7,8 @@ function run(msg, matches)
end
return {
description = "When user sends image URL (ends with png, jpg, jpeg) download and send it to origin.",
usage = "",
description = "Wenn ein Link zu einem Bild gesendet wird, läd und sendet der Bot das Bild.",
usage = "Link zum Bild",
patterns = {
"(https?://[%w-_%.%?%.:/%+=&]+%.png)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.jpg)$",

View File

@ -1,6 +1,6 @@
do
function getGoogleImage(text)
function getGoogleImage2(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)
@ -29,7 +29,7 @@ end
function run(msg, matches)
local receiver = get_receiver(msg)
local text = matches[1]
local url = getGoogleImage(text)
local url = getGoogleImage2(text)
if not url then
return "Kein Bild gefunden."

View File

@ -1,5 +1,4 @@
function run(msg, matches)
randomValue = math.random(6)
if randomValue == 1 then
send_photo(get_receiver(msg), "pictures/justkitten/justkitten1.jpg", ok_cb, false)
@ -22,3 +21,4 @@ return {
patterns = {"^/jk"},
run = run
}
--by Akamaru

View File

@ -1,5 +1,4 @@
function run(msg, matches)
randomValue = math.random(4)
if randomValue == 1 then
send_photo(get_receiver(msg), "pictures/cats/cat1.jpg", ok_cb, false)
@ -18,3 +17,4 @@ return {
patterns = {"^/kitty"},
run = run
}
--by Akamaru

View File

@ -30,3 +30,4 @@ return {
"^/Tsukasa"},
run = run
}
--by Akamaru

View File

@ -31,7 +31,7 @@ end
function run(msg, matches)
local lyrics = getLyrics(msg.text)
if (lyrics == nil) then
return "Zzzzz..."
return "Nichts gefunden!"
else
return lyrics
end

View File

@ -18,3 +18,4 @@ return {
run = run
}
end
--by Akamaru

View File

@ -7,8 +7,8 @@ function run(msg, matches)
end
return {
description = "When user sends media URL (ends with gif, mp4, pdf, etc.) download and send it to origin.",
usage = "",
description = "Wenn ein Link zu einer Datei gesendet wird, läd und sendet der Bot die Datei.",
usage = "Link zur Datei",
patterns = {
"(https?://[%w-_%.%?%.:/%+=&]+%.gif)$",
"(https?://[%w-_%.%?%.:/%+=&]+%.mp4)$",

View File

@ -12,4 +12,4 @@ return {
"Meep"},
run = run
}
--by Akamaru

View File

@ -9,3 +9,4 @@ return {
"^/Nairad"},
run = run
}
--by Akamaru

View File

@ -1,9 +1,6 @@
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",
@ -11,3 +8,4 @@ return {
patterns = {"^/nau"},
run = run
}
--by Akamaru

View File

@ -1,9 +1,6 @@
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!",
@ -11,3 +8,4 @@ return {
patterns = {"^/neorame"},
run = run
}
--by Akamaru

View File

@ -1,11 +1,7 @@
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",
@ -15,4 +11,4 @@ return {
"^Nissan"},
run = run
}
--by Akamaru

View File

@ -1,15 +1,12 @@
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
}
--by Akamaru

View File

@ -1,11 +1,7 @@
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",
@ -13,4 +9,4 @@ return {
"^Nyu"},
run = run
}
--by Akamaru

View File

@ -6,11 +6,11 @@ function run(msg, matches)
-- local new_matches = {query}
-- return g.run(msg, new_matches)
local results = findPorn(matches[1])
local results = findPornhub(matches[1])
return results-- build_result(results)
end
function findPorn(query)
function findPornhub(query)
local api = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site:pornhub.com+viewkey+" .. query:gsub(" ", "+")
-- Do the request
@ -41,7 +41,7 @@ function build_result(query)
end
return {
description = "",
description = "Sendet ein PornHub Video",
usage = "/pornhub",
patterns = {"^/pornhub (.*)$",
"^/ph (.*)$"},

View File

@ -7,8 +7,6 @@ end
return {
description = "Ein simpler Taschenrechner",
usage = "/calc [Rechnung]",
patterns = {
"^/calc (.*)$"
},
patterns = {"^/calc (.*)$"},
run = run
}

View File

@ -1,12 +1,12 @@
function run(msg, matches)
plugins = {}
load_plugins()
return 'Plugins reloaded'
return 'Plugins erfolgreich geladen!'
end
return {
description = "Reloads Bot Plugins",
usage = "/reload",
description = "",
usage = "",
patterns = {"^/reload$"},
run = run,
privileged = true

View File

@ -1,11 +1,8 @@
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",
@ -16,4 +13,4 @@ return {
"^RICH BITCH"},
run = run
}
--by Akamaru

View File

@ -48,3 +48,4 @@ return {
"^/Sorata"},
run = run
}
--by Akamaru

View File

@ -66,4 +66,4 @@ return {
"^/Yomi"},
run = run
}
--by Akamaru

View File

@ -1,12 +1,12 @@
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',
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.'}
'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
@ -19,5 +19,5 @@ return {
"^*Stille*"},
run = run
}
end
--by Akamaru

View File

@ -38,11 +38,11 @@ function run(msg, matches)
return "Fehler: "..response_code
end
local data = json:decode(response_body)
return "Tweet gesendet! Sieh ihn dir an: https://twitter.com/TalesOfTelegram/status/"..data.id_str
return "Tweet gesendet!"..data.id_str
end
return {
description = "Sends a tweet",
description = "",
usage = "",
patterns = {"^/tw (.+)"},
run = run,

View File

@ -25,14 +25,14 @@ end
function run(msg, matches)
local text = getUrbanDictionary(msg.text)
if (text == nil) then
return "Zzzzz..."
return "Nichts gefunden!"
else
return text
end
end
return {
description = "get urban dictionary definition",
description = "Zeigt eine Urban Dictionary Definition",
usage = "/ud [topic]",
patterns = {"^/ud (.*)$"},
run = run

View File

@ -27,8 +27,15 @@ function run(msg, matches)
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" or string.match(title, "DeviantArt") then
--Ignoring 301, 302, 404 and more
if title == "301 Moved Permanently" or
title == "" or
title == "404 Not Found" or
title == "302 Found" or
title == "Moved Permanently" or
string.match(title, "deviantArt") or
string.match(title, "twitch") or
string.match(title, "eBay</title>") then
print('Invalide, da "'..title..'"')
else
return title
@ -37,11 +44,8 @@ function run(msg, matches)
return {
description = "Postet URL-Titel",
usage = "",
patterns = {
"(https?://[%w-_%.%?%.:/%+=&]+)$",
},
usage = "Irgendein Link",
patterns = {"(https?://[%w-_%.%?%.:/%+=&]+)$",},
run = run
}
end

View File

@ -12,5 +12,4 @@ return {
},
run = run
}
end

View File

@ -6,8 +6,7 @@ end
return {
description = "Sagt dass ihr wieder da seid",
usage = "/wd",
patterns = {
"^/wd(.*)$"
},
patterns = {"^/wd(.*)$"},
run = run
}
--by Akamaru

View File

@ -4,6 +4,7 @@ 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",
@ -11,3 +12,4 @@ return {
run = run
}
end
--by Akamaru

View File

@ -1,15 +1,12 @@
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)"},
patterns = {"^/yolo"},
run = run
}
--by Akamaru

View File

@ -2,15 +2,15 @@
function run(msg, matches)
-- local g = require "./plugins/google"
-- local query = "site:pornhub.com+viewkey+" .. matches[1]
-- local query = "site:youporn.com+viewkey+" .. matches[1]
-- local new_matches = {query}
-- return g.run(msg, new_matches)
local results = findAss(matches[1])
local results = findYouporn(matches[1])
return results-- build_result(results)
end
function findAss(query)
function findYouporn(query)
local api = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site:youporn.com+viewkey+" .. query:gsub(" ", "+")
-- Do the request
@ -41,7 +41,7 @@ function build_result(query)
end
return {
description = "",
description = "Sendet ein YouPorn Video",
usage = "/youporn",
patterns = {"^/youporn (.*)$",
"^/yp (.*)$"},