new pattern for urban_dictionary.lua

This commit is contained in:
Akamaru 2015-07-18 15:32:46 +02:00
parent c712fa44b2
commit 7555378358

View File

@ -1,5 +1,5 @@
function getUrbanDictionary(text) function getUrbanDictionary(text)
local topic = string.match(text, "/ud (.+)") or string.match(text, "http://([A-Za-z0-9-_-]+).urbanup.com/") local topic = string.match(text, "/ud (.+)") or string.match(text, "http://([A-Za-z0-9-_-]+).urbanup.com/") or string.match(text, "http://www.urbandictionary.com/define.php[?]term=([A-Za-z0-9-_-]+)")
topic = url_encode(topic) topic = url_encode(topic)
b = http.request("http://api.urbandictionary.com/v0/define?term=" .. topic) b = http.request("http://api.urbandictionary.com/v0/define?term=" .. topic)
res = json:decode(b) res = json:decode(b)
@ -35,7 +35,8 @@ return {
description = "Zeigt eine Urban Dictionary Definition", description = "Zeigt eine Urban Dictionary Definition",
usage = {"/ud [Begriff]"}, usage = {"/ud [Begriff]"},
patterns = {"^/ud (.*)$", patterns = {"^/ud (.*)$",
"^http://([A-Za-z0-9-_-]+).urbanup.com/" "^http://([A-Za-z0-9-_-]+).urbanup.com/",
"^http://www.urbandictionary.com/define.php[?]term=([A-Za-z0-9-_-]+)"
}, },
run = run run = run
} }