more german translation and optimizations

This commit is contained in:
Akamaru 2015-05-12 20:15:15 +02:00
parent ef6e633da9
commit 0c97b53d58
28 changed files with 105 additions and 137 deletions

View File

@ -38,33 +38,33 @@ end
function msg_valid(msg) function msg_valid(msg)
-- Dont process outgoing messages -- Dont process outgoing messages
if msg.out then if msg.out then
print('\27[36mNot valid: msg from us\27[39m') print('\27[36mNicht gültig: Nachricht von mir\27[39m')
return false return false
end end
-- Before bot was started -- Before bot was started
if msg.date < now then if msg.date < now then
print('\27[36mNot valid: old msg\27[39m') print('\27[36mNicht gültig: alte Nachricht\27[39m')
return false return false
end end
if msg.unread == 0 then if msg.unread == 0 then
print('\27[36mNot valid: readed\27[39m') print('\27[36mNicht gültig: gelesen\27[39m')
return false return false
end end
if msg.service then if msg.service then
print('\27[36mNot valid: service\27[39m') print('\27[36mNicht gültig: Service\27[39m')
return false return false
end end
if not msg.to.id then if not msg.to.id then
print('\27[36mNot valid: To id not provided\27[39m') print('\27[36mNicht gültig: To id not provided\27[39m')
return false return false
end end
if not msg.from.id then if not msg.from.id then
print('\27[36mNot valid: From id not provided\27[39m') print('\27[36mNicht gültig: From id not provided\27[39m')
return false return false
end end
@ -114,7 +114,7 @@ function match_plugin(plugin, plugin_name, msg)
for k, pattern in pairs(plugin.patterns) do for k, pattern in pairs(plugin.patterns) do
local matches = match_pattern(pattern, msg.text) local matches = match_pattern(pattern, msg.text)
if matches then if matches then
print("msg matches: ", pattern) print("Nachricht stimmt überein mit ", pattern)
if is_plugin_disabled_on_chat(plugin_name, receiver) then if is_plugin_disabled_on_chat(plugin_name, receiver) then
return nil return nil
@ -150,7 +150,7 @@ end
-- Save the content of _config to config.lua -- Save the content of _config to config.lua
function save_config( ) function save_config( )
serialize_to_file(_config, './data/config.lua') serialize_to_file(_config, './data/config.lua')
print ('saved config into ./data/config.lua') print ('Configuration in ./data/config.lua gespeichert')
end end
-- Returns the config from config.lua file. -- Returns the config from config.lua file.
@ -159,14 +159,14 @@ function load_config( )
local f = io.open('./data/config.lua', "r") local f = io.open('./data/config.lua', "r")
-- If config.lua doesnt exists -- If config.lua doesnt exists
if not f then if not f then
print ("Created new config file: data/config.lua") print ("Neue Config-Datei erstellt: data/config.lua")
create_config() create_config()
else else
f:close() f:close()
end end
local config = loadfile ("./data/config.lua")() local config = loadfile ("./data/config.lua")()
for v,user in pairs(config.sudo_users) do for v,user in pairs(config.sudo_users) do
print("Allowed user: " .. user) print("Erlaubter Benutzer: " .. user)
end end
return config return config
end end
@ -175,7 +175,7 @@ function load_cred( )
local cf = io.open('./data/credentials.lua', "r") local cf = io.open('./data/credentials.lua', "r")
-- If credentials.lua doesnt exists -- If credentials.lua doesnt exists
if not cf then if not cf then
print ("Created new credentials file: data/credentials.lua") print ("Neue Credentials-Datei erstellt: data/credentials.lua")
create_cred() create_cred()
else else
cf:close() cf:close()
@ -189,33 +189,13 @@ function create_config( )
-- A simple config with basic plugins and ourserves as priviled user -- A simple config with basic plugins and ourserves as priviled user
config = { config = {
enabled_plugins = { enabled_plugins = {
"9gag",
"eur",
"echo",
"btc",
"get",
"giphy",
"google",
"gps",
"help", "help",
"images", "plugins" },
"img_google",
"location",
"media",
"plugins",
"channels",
"set",
"stats",
"time",
"version",
"weather",
"xkcd",
"youtube" },
sudo_users = {our_id}, sudo_users = {our_id},
disabled_channels = {} disabled_channels = {}
} }
serialize_to_file(config, './data/config.lua') serialize_to_file(config, './data/config.lua')
print ('saved config into ./data/config.lua') print ('Configuration in ./data/config.lua gespeichert')
end end
function create_cred( ) function create_cred( )
@ -243,7 +223,7 @@ function create_cred( )
yandex_rich_content_apikey = "" yandex_rich_content_apikey = ""
} }
serialize_to_file(cred, './data/credentials.lua') serialize_to_file(cred, './data/credentials.lua')
print ('saved credentials into ./data/credentials.lua') print ('Credentials gespeichert in ./data/credentials.lua')
end end
function on_our_id (id) function on_our_id (id)
@ -268,7 +248,7 @@ end
-- Enable plugins in config.json -- Enable plugins in config.json
function load_plugins() function load_plugins()
for k, v in pairs(_config.enabled_plugins) do for k, v in pairs(_config.enabled_plugins) do
print("Loading plugin", v) print("Lade Plugin", v)
local t = loadfile("plugins/"..v..'.lua')() local t = loadfile("plugins/"..v..'.lua')()
plugins[v] = t plugins[v] = t
end end

View File

@ -1,7 +1,6 @@
function run(msg, matches) function run(msg, matches)
--get username
local user_name = get_name(msg) local user_name = get_name(msg)
return '' .. user_name .. ' ist nun AFK' return user_name .. ' ist nun AFK'
end end
return { return {

View File

@ -68,7 +68,7 @@ end
return { return {
description = "", description = "",
usage = {"Das kann nur Akamaru"}, usage = {"/channel kann nur Akamaru"},
patterns = {"^/channel? (enable)","^/channel? (disable)" }, patterns = {"^/channel? (enable)","^/channel? (disable)" },
run = run, run = run,
privileged = true, privileged = true,

View File

@ -5,7 +5,7 @@ end
return { return {
description = "Zeigt das aktuelle Datum an", description = "Zeigt das aktuelle Datum an",
usage = "/date", usage = {"/date"},
patterns = {"^/date$"}, patterns = {"^/date$"},
run = run run = run
} }

View File

@ -48,12 +48,9 @@ function run(msg, matches)
end end
return { return {
description = "Send dmm video info", description = "Sendet dmm Video Info",
usage = {"/dmm (id): Send a dmm video cover and title. If not id, send a random one"}, usage = {"/dmm","/dmm (id)"},
patterns = { patterns = {"^/dmm$","^/dmm (.+)"},
"^/dmm$",
"^/dmm (.+)"
},
run = run run = run
} }

View File

@ -33,7 +33,7 @@ local function get_value(chat, value_name)
end end
local value = _values[chat][value_name] local value = _values[chat][value_name]
if ( value == nil) then if ( value == nil) then
return "Konnte nicht finden "..value_name return 'Konnte "'..value_name..' nicht finden'
end end
return value_name.." = "..value return value_name.." = "..value
end end
@ -69,11 +69,10 @@ local function lex(msg)
end end
return { return {
description = "Bekommt Variable, die mit !set gesetzt wurde", description = "Bekommt Variable, die mit /set gesetzt wurde",
usage = "/get (Variable)", usage = {"/get (Variable)"},
patterns = { patterns = {"^/get (%a+)$","^/get$"},
"^/get (%a+)$", patterns = {"^/get (%a+)$","^/get$"},
"^/get$"},
run = run, run = run,
pre_process = lex pre_process = lex
} }

View File

@ -31,11 +31,8 @@ end
return { return {
description = "Andere User zu einer Chat-Gruppe hinzufügen", description = "Andere User zu einer Chat-Gruppe hinzufügen",
usage = "/invite name [user_name], !invite id [user_id]", usage = "/invite name [user_name], /invite id [user_id]",
patterns = { patterns = {"^/invite (name) (.*)$","^/invite (id) (%d+)$"},
"^/invite (name) (.*)$",
"^/invite (id) (%d+)$"
},
run = run run = run
} }

View File

@ -17,7 +17,7 @@ local function save_cron(msg, url, delete)
end end
end end
serialize_to_file(cronned, 'data/isup.lua') serialize_to_file(cronned, 'data/isup.lua')
return 'Saved!' return 'Gespeichert!'
end end
local function is_up_socket(ip, port) local function is_up_socket(ip, port)
@ -82,7 +82,7 @@ local function cron()
for k,url in pairs(urls) do for k,url in pairs(urls) do
print('Checking', url) print('Checking', url)
if not isup(url) then if not isup(url) then
local text = url..' looks DOWN from here. ??' local text = url..' scheint DOWN zu sein'
send_msg(chan, text, ok_cb, false) send_msg(chan, text, ok_cb, false)
end end
end end
@ -92,20 +92,20 @@ end
local function run(msg, matches) local function run(msg, matches)
if matches[1] == 'remove' then if matches[1] == 'remove' then
if not is_sudo(msg) then if not is_sudo(msg) then
return 'This command requires privileged user' return 'Du darfst diesen Befehl nicht nutzen!'
end end
return save_cron(msg, matches[2], true) return save_cron(msg, matches[2], true)
elseif matches[1] == 'save' then elseif matches[1] == 'save' then
if not is_sudo(msg) then if not is_sudo(msg) then
return 'This command requires privileged user' return 'Du darfst diesen Befehl nicht nutzen!'
end end
return save_cron(msg, matches[2]) return save_cron(msg, matches[2])
elseif isup(matches[1]) then elseif isup(matches[1]) then
return matches[1]..' looks UP from here. ??' return matches[1]..' ist UP'
else else
return matches[1]..' looks DOWN from here. ??' return matches[1]..' scheint DOWN zu sein'
end end
end end
@ -113,8 +113,8 @@ return {
description = "Check if a website or server is up.", description = "Check if a website or server is up.",
usage = { usage = {
"/isup [host]: Performs a HTTP request or Socket (ip:port) connexion", "/isup [host]: Performs a HTTP request or Socket (ip:port) connexion",
"/isup cron [host]: Every 5mins check if host is up. (Requires privileged user)", "/isup save [host]: Every 5mins check if host is up. (Requires privileged user)",
"/isup cron delete [host]: Disable checking that host." "/isup remove [host]: Disable checking that host."
}, },
patterns = { patterns = {
"^/isup (remove) (.*)$", "^/isup (remove) (.*)$",

View File

@ -11,27 +11,27 @@ local function run(msg, matches)
local mime_type = mimetype.get_content_type_no_sub(ext) local mime_type = mimetype.get_content_type_no_sub(ext)
if ext == 'gif' then if ext == 'gif' then
print('send_file') print('Sende Datei')
send_document(receiver, file, rmtmp_cb, cb_extra) send_document(receiver, file, rmtmp_cb, cb_extra)
elseif mime_type == 'text' then elseif mime_type == 'text' then
print('send_document') print('Sende Document')
send_document(receiver, file, rmtmp_cb, cb_extra) send_document(receiver, file, rmtmp_cb, cb_extra)
elseif mime_type == 'image' then elseif mime_type == 'image' then
print('send_photo') print('Sende Foto')
send_photo(receiver, file, rmtmp_cb, cb_extra) send_photo(receiver, file, rmtmp_cb, cb_extra)
elseif mime_type == 'audio' then elseif mime_type == 'audio' then
print('send_audio') print('Sende Audio')
send_audio(receiver, file, rmtmp_cb, cb_extra) send_audio(receiver, file, rmtmp_cb, cb_extra)
elseif mime_type == 'video' then elseif mime_type == 'video' then
print('send_video') print('Sende Video')
send_video(receiver, file, rmtmp_cb, cb_extra) send_video(receiver, file, rmtmp_cb, cb_extra)
else else
print('send_file') print('Sende Datei')
send_document(receiver, file, rmtmp_cb, cb_extra) send_document(receiver, file, rmtmp_cb, cb_extra)
end end

View File

@ -60,7 +60,7 @@ local function parseText(chat, text)
if (ip ~= nil) then if (ip ~= nil) then
return mineSearch(ip, "25565", chat) return mineSearch(ip, "25565", chat)
end end
return "FEHLER: Keine Input IP??" return "FEHLER: Keine Input IP?"
end end
@ -73,8 +73,6 @@ end
return { return {
description = "Dursucht Minecraft-Server und sendet Infos", description = "Dursucht Minecraft-Server und sendet Infos",
usage = usage, usage = usage,
patterns = { patterns = {"^/mine (.*)$"},
"^/mine (.*)$"
},
run = run run = run
} }

View File

@ -5,7 +5,7 @@ end
return { return {
description = "Naira Derp", description = "Naira Derp",
usage = {"/nairad","/Nairad"}, usage = {"/nairad","/Nairad"},
patterns = {"^/nairad","^/Nairad"}, patterns = {"^/nairad$","^/Nairad$"},
run = run run = run
} }
--by Akamaru --by Akamaru

View File

@ -4,8 +4,8 @@ end
return { return {
description = "RTL Nau", description = "RTL Nau",
usage = {"/nau"}, usage = {"/nau","/now"},
patterns = {"^/nau"}, patterns = {"^/nau$","^/now$"},
run = run run = run
} }
--by Akamaru --by Akamaru

View File

@ -49,7 +49,7 @@ end
local function enable_plugin( plugin_name ) local function enable_plugin( plugin_name )
print('checking if '..plugin_name..' exists') print('Überprüfe ob "'..plugin_name..'" existiert')
-- Check if plugin is enabled -- Check if plugin is enabled
if plugin_enabled(plugin_name) then if plugin_enabled(plugin_name) then
return 'Plugin "'..plugin_name..'" ist aktiviert!' return 'Plugin "'..plugin_name..'" ist aktiviert!'
@ -58,19 +58,19 @@ local function enable_plugin( plugin_name )
if plugin_exists(plugin_name) then if plugin_exists(plugin_name) then
-- Add to the config table -- Add to the config table
table.insert(_config.enabled_plugins, plugin_name) table.insert(_config.enabled_plugins, plugin_name)
print(plugin_name..' added to _config table') print(plugin_name..' zu to _config table hinzugefügt')
save_config() save_config()
-- Reload the plugins -- Reload the plugins
return reload_plugins( ) return reload_plugins( )
else else
return 'Das Plugin "'..plugin_name..'" exestiert nicht!' return 'Das Plugin "'..plugin_name..'" existiert nicht!'
end end
end end
local function disable_plugin( name, chat ) local function disable_plugin( name, chat )
-- Check if plugins exists -- Check if plugins exists
if not plugin_exists(name) then if not plugin_exists(name) then
return 'Das Plugin "'..plugin_name..'" exestiert nicht!' return 'Das Plugin "'..plugin_name..'" existiert nicht!'
end end
local k = plugin_enabled(name) local k = plugin_enabled(name)
-- Check if plugin is enabled -- Check if plugin is enabled
@ -85,7 +85,7 @@ end
local function disable_plugin_on_chat(receiver, plugin) local function disable_plugin_on_chat(receiver, plugin)
if not plugin_exists(plugin) then if not plugin_exists(plugin) then
return "Dieses Plugin exestiert nicht!" return "Dieses Plugin existiert nicht!"
end end
if not _config.disabled_plugin_on_chat then if not _config.disabled_plugin_on_chat then
@ -104,11 +104,11 @@ end
local function reenable_plugin_on_chat(receiver, plugin) local function reenable_plugin_on_chat(receiver, plugin)
if not _config.disabled_plugin_on_chat then if not _config.disabled_plugin_on_chat then
return 'There aren\'t any disabled plugin.' return 'Hier sind keine Plugins deaktiviert.'
end end
if not _config.disabled_plugin_on_chat[receiver] then if not _config.disabled_plugin_on_chat[receiver] then
return 'There aren\'t any disabled plugin for this chat.' return 'Hier sind keine Plugins deaktiviert.'
end end
if not _config.disabled_plugin_on_chat[receiver][plugin] then if not _config.disabled_plugin_on_chat[receiver][plugin] then
@ -130,14 +130,14 @@ local function run(msg, matches)
if matches[1] == 'enable' and matches[3] == 'chat' then if matches[1] == 'enable' and matches[3] == 'chat' then
local receiver = get_receiver(msg) local receiver = get_receiver(msg)
local plugin = matches[2] local plugin = matches[2]
print("enable "..plugin..' on this chat') print('Aktiviere "'..plugin..'" in diesem Chat')
return reenable_plugin_on_chat(receiver, plugin) return reenable_plugin_on_chat(receiver, plugin)
end end
-- Enable a plugin -- Enable a plugin
if matches[1] == 'enable' then if matches[1] == 'enable' then
local plugin_name = matches[2] local plugin_name = matches[2]
print("enable: "..matches[2]) print("A+: "..matches[2])
return enable_plugin(plugin_name) return enable_plugin(plugin_name)
end end
@ -145,13 +145,13 @@ local function run(msg, matches)
if matches[1] == 'disable' and matches[3] == 'chat' then if matches[1] == 'disable' and matches[3] == 'chat' then
local plugin = matches[2] local plugin = matches[2]
local receiver = get_receiver(msg) local receiver = get_receiver(msg)
print("disable "..plugin..' on this chat') print('Deaktiviere "'..plugin..'" in diesem Chat')
return disable_plugin_on_chat(receiver, plugin) return disable_plugin_on_chat(receiver, plugin)
end end
-- Disable a plugin -- Disable a plugin
if matches[1] == 'disable' then if matches[1] == 'disable' then
print("disable: "..matches[2]) print("Deaktiviere: "..matches[2])
return disable_plugin(matches[2]) return disable_plugin(matches[2])
end end

View File

@ -27,7 +27,7 @@ function save_quote(msg)
end end
if quotes_table[to_id] == nil then if quotes_table[to_id] == nil then
print ('New quote key to_id: '..to_id) print ('Neuer quote key to_id: '..to_id)
quotes_table[to_id] = {} quotes_table[to_id] = {}
end end

View File

@ -5,8 +5,8 @@ function run(msg, matches)
end end
return { return {
description = "", description = "Läd die Plugins neu",
usage = "", usage = {"/reload (kann nur Akamaru)"},
patterns = {"^/reload$"}, patterns = {"^/reload$"},
run = run, run = run,
privileged = true privileged = true

View File

@ -30,7 +30,7 @@ function run(msg, matches)
end end
return { return {
description = "Sendet euch ein Char aus Sakurasou no Pet na Kanojo", description = "Sendet euch ein Charakter aus Sakurasou no Pet na Kanojo",
usage = {"/shiina","/Shiina","/chihiro","/Chihiro","/jin","/Jin","/misaki","/Misaki","/nanami","/Nanami","/ryuunosuke","/Ryuunosuke","/sorata","/Sorata"}, usage = {"/shiina","/Shiina","/chihiro","/Chihiro","/jin","/Jin","/misaki","/Misaki","/nanami","/Nanami","/ryuunosuke","/Ryuunosuke","/sorata","/Sorata"},
patterns = {"^/shiina","^/Shiina","^/chihiro","^/Chihiro","^/jin","^/Jin","^/misaki","^/Misaki","^/nanami","^/Nanami","^/ryuunosuke","^/Ryuunosuke","^/sorata","^/Sorata"}, patterns = {"^/shiina","^/Shiina","^/chihiro","^/Chihiro","^/jin","^/Jin","^/misaki","^/Misaki","^/nanami","^/Nanami","^/ryuunosuke","^/Ryuunosuke","^/sorata","^/Sorata"},
run = run run = run

View File

@ -42,7 +42,7 @@ function run(msg, matches)
end end
return { return {
description = "Sendet euch ein Senran Kagura Char", description = "Sendet euch ein Senran Kagura Charakter",
usage = {"/asuka","/Asuka","/hibari","/Hibari","/ikaruga","/Ikaruga","/katsuragi","/Katsuragi","/yagyuu","/Yagyuu","/haruka","/Haruka","/hikage","/Hikage","/homura","/Homura","/mirai","/Mirai","/yomi","/Yomi"}, usage = {"/asuka","/Asuka","/hibari","/Hibari","/ikaruga","/Ikaruga","/katsuragi","/Katsuragi","/yagyuu","/Yagyuu","/haruka","/Haruka","/hikage","/Hikage","/homura","/Homura","/mirai","/Mirai","/yomi","/Yomi"},
patterns = {"^/asuka","^/Asuka","^/hibari","^/Hibari","^/ikaruga","^/Ikaruga","^/katsuragi","^/Katsuragi","^/yagyuu","^/Yagyuu","^/haruka","^/Haruka","^/hikage","^/Hikage","^/homura","^/Homura","^/mirai","^/Mirai","^/yomi","^/Yomi"}, patterns = {"^/asuka","^/Asuka","^/hibari","^/Hibari","^/ikaruga","^/Ikaruga","^/katsuragi","^/Katsuragi","^/yagyuu","^/Yagyuu","^/haruka","^/Haruka","^/hikage","^/Hikage","^/homura","^/Homura","^/mirai","^/Mirai","^/yomi","^/Yomi"},
run = run run = run

View File

@ -24,7 +24,7 @@ end
return { return {
description = "Setze Variable", description = "Setze Variable",
usage = "/set [Variablenname] [Daten]", usage = {"/set [Variablenname] [Daten]"},
patterns = {"^/set (%a+) (.+)$"}, patterns = {"^/set (%a+) (.+)$"},
run = run run = run
} }

View File

@ -32,7 +32,7 @@ end
return { return {
description = "Führt Befehle in der Konsole aus", description = "Führt Befehle in der Konsole aus",
usage = {"Das kann nur Akamaru"}, usage = {"/sh kann nur Akamaru"},
patterns = {"^/uptime", "^/sh (.*)$"}, patterns = {"^/uptime", "^/sh (.*)$"},
run = run, run = run,
privileged = true privileged = true

View File

@ -12,16 +12,16 @@ function update_user_stats(msg)
local from_id = tostring(msg.from.id) local from_id = tostring(msg.from.id)
local to_id = tostring(msg.to.id) local to_id = tostring(msg.to.id)
local user_name = get_name(msg) local user_name = get_name(msg)
print ('New message from '..user_name..'['..from_id..']'..' to '..to_id) print ('Neue Nachricht von '..user_name..'['..from_id..']'..' in '..to_id)
-- If last name is nil dont save last_name. -- If last name is nil dont save last_name.
local user_last_name = msg.from.last_name local user_last_name = msg.from.last_name
local user_print_name = msg.from.print_name local user_print_name = msg.from.print_name
if _stats[to_id] == nil then if _stats[to_id] == nil then
print ('New stats key to_id: '..to_id) print ('Neuer stats key to_id: '..to_id)
_stats[to_id] = {} _stats[to_id] = {}
end end
if _stats[to_id][from_id] == nil then if _stats[to_id][from_id] == nil then
print ('New stats key from_id: '..to_id) print ('Neuer stats key from_id: '..to_id)
_stats[to_id][from_id] = { _stats[to_id][from_id] = {
user_id = from_id, user_id = from_id,
name = user_name, name = user_name,
@ -43,10 +43,10 @@ function read_file_stats( )
-- If file doesn't exists -- If file doesn't exists
if f == nil then if f == nil then
-- Create a new empty table -- Create a new empty table
print ('Created user stats file '.._file_stats) print ('"user stats file" erstellt '.._file_stats)
serialize_to_file({}, _file_stats) serialize_to_file({}, _file_stats)
else else
print ('Stats loaded: '.._file_stats) print ('Stats geladen: '.._file_stats)
f:close() f:close()
end end
return loadfile (_file_stats)() return loadfile (_file_stats)()
@ -95,7 +95,7 @@ local function run(msg, matches)
if msg.to.type == 'chat' or is_sudo(msg) then if msg.to.type == 'chat' or is_sudo(msg) then
return get_stats_status(msg) return get_stats_status(msg)
else else
return 'Stats works only chats' return 'Stats funktioniert nur in Chats'
end end
else else
update_user_stats(msg) update_user_stats(msg)

View File

@ -69,7 +69,7 @@ end
return { return {
description = "Steam-Info", description = "Steam-Info",
usage = "", usage = {"store.steampowered.com/app Link","steamcommunity.com/app Link"},
patterns = { patterns = {
"store.steampowered.com/app/([0-9]+)", "store.steampowered.com/app/([0-9]+)",
"steamcommunity.com/app/([0-9]+)" "steamcommunity.com/app/([0-9]+)"

View File

@ -27,7 +27,7 @@ local function send_generics_from_url_callback(cb_extra, success, result)
-- The previously image to remove -- The previously image to remove
if remove_path ~= nil then if remove_path ~= nil then
os.remove(remove_path) os.remove(remove_path)
print("Deleted: "..remove_path) print("Gelöscht: "..remove_path)
end end
-- Nil or empty, exit case (no more urls) -- Nil or empty, exit case (no more urls)
@ -110,23 +110,23 @@ end
local function check_keys() local function check_keys()
if consumer_key:isempty() then if consumer_key:isempty() then
return "Twitter Consumer Key is empty, write it in plugins/twitter.lua" return "Twitter Consumer Key ist nicht vorhanden, schreibe ihn in data/credentials.lua"
end end
if consumer_secret:isempty() then if consumer_secret:isempty() then
return "Twitter Consumer Secret is empty, write it in plugins/twitter.lua" return "Twitter Consumer Secret ist nicht vorhanden, schreibe ihn in data/credentials.lua"
end end
if access_token:isempty() then if access_token:isempty() then
return "Twitter Access Token is empty, write it in plugins/twitter.lua" return "Twitter Access Token ist nicht vorhanden, schreibe ihn in data/credentials.lua"
end end
if access_token_secret:isempty() then if access_token_secret:isempty() then
return "Twitter Access Token Secret is empty, write it in plugins/twitter.lua" return "Twitter Access Token Secret ist nicht vorhanden, schreibe ihn in data/credentials.lua"
end end
return "" return ""
end end
local function analyze_tweet(tweet) local function analyze_tweet(tweet)
local header = "Tweet from " .. tweet.user.name .. " (@" .. tweet.user.screen_name .. ")\n" -- "Link: https://twitter.com/statuses/" .. tweet.id_str local header = "Tweet von " .. tweet.user.name .. " (@" .. tweet.user.screen_name .. ")\n" -- "Link: https://twitter.com/statuses/" .. tweet.id_str
local text = tweet.text local text = tweet.text
-- replace short URLs -- replace short URLs
@ -170,12 +170,12 @@ local function getTweet(msg, base, all)
local response_code, response_headers, response_status_line, response_body = client:PerformRequest("GET", twitter_url, base) local response_code, response_headers, response_status_line, response_body = client:PerformRequest("GET", twitter_url, base)
if response_code ~= 200 then if response_code ~= 200 then
return "Can't connect, maybe the user don't exist." return "Dieser User scheint nicht zu existieren."
end end
local response = json:decode(response_body) local response = json:decode(response_body)
if #response == 0 then if #response == 0 then
return "Can't retrieve any tweet, sorry" return "Konnte keine Tweets finden"
end end
if all then if all then
for i,tweet in pairs(response) do for i,tweet in pairs(response) do
@ -214,7 +214,7 @@ local function run(msg, matches)
if #matches == 4 then if #matches == 4 then
local n = tonumber(matches[4]) local n = tonumber(matches[4])
if n > 10 then if n > 10 then
return "You only can ask for 10 tweets at most" return "Nicht so schnell bitte"
end end
count = matches[4] count = matches[4]
all = true all = true

View File

@ -15,18 +15,17 @@ local client = OAuth.new(consumer_key, consumer_secret, {
}) })
function run(msg, matches) function run(msg, matches)
if consumer_key:isempty() then if consumer_key:isempty() then
return "Twitter Consumer Key is empty, write it in plugins/twitter.lua" return "Twitter Consumer Key ist nicht vorhanden, schreibe ihn in data/credentials.lua"
end end
if consumer_secret:isempty() then if consumer_secret:isempty() then
return "Twitter Consumer Secret is empty, write it in plugins/twitter.lua" return "Twitter Consumer Secret ist nicht vorhanden, schreibe ihn in data/credentials.lua"
end end
if access_token:isempty() then if access_token:isempty() then
return "Twitter Access Token is empty, write it in plugins/twitter.lua" return "Twitter Access Token ist nicht vorhanden, schreibe ihn in data/credentials.lua"
end end
if access_token_secret:isempty() then if access_token_secret:isempty() then
return "Twitter Access Token Secret is empty, write it in plugins/twitter.lua" return "Twitter Access Token Secret ist nicht vorhanden, schreibe ihn in data/credentials.lua"
end end
local twitter_url = "https://api.twitter.com/1.1/statuses/show/" .. matches[1] .. ".json" local twitter_url = "https://api.twitter.com/1.1/statuses/show/" .. matches[1] .. ".json"
@ -69,8 +68,8 @@ function run(msg, matches)
end end
return { return {
description = "When user sends twitter URL, send text and images to origin. Requieres OAuth Key.", description = "Wenn ein Twitter Link gesendet wird, wird der Tweet gepostet",
usage = "", usage = {"twitter.com Link"},
patterns = {"https://twitter.com/[^/]+/status/([0-9]+)"}, patterns = {"https://twitter.com/[^/]+/status/([0-9]+)"},
run = run run = run
} }

View File

@ -18,16 +18,16 @@ local client = OAuth.new(consumer_key, consumer_secret, {
function run(msg, matches) function run(msg, matches)
if consumer_key:isempty() then if consumer_key:isempty() then
return "Twitter Consumer Key is empty, write it in plugins/twitter_send.lua" return "Twitter Consumer Key ist nicht vorhanden, schreibe ihn in data/credentials.lua"
end end
if consumer_secret:isempty() then if consumer_secret:isempty() then
return "Twitter Consumer Secret is empty, write it in plugins/twitter_send.lua" return "Twitter Consumer Secret ist nicht vorhanden, schreibe ihn in data/credentials.lua"
end end
if access_token:isempty() then if access_token:isempty() then
return "Twitter Access Token is empty, write it in plugins/twitter_send.lua" return "Twitter Access Token ist nicht vorhanden, schreibe ihn in data/credentials.lua"
end end
if access_token_secret:isempty() then if access_token_secret:isempty() then
return "Twitter Access Token Secret is empty, write it in plugins/twitter_send.lua" return "Twitter Access Token Secret ist nicht vorhanden, schreibe ihn in data/credentials.lua"
end end
local response_code, response_headers, response_status_line, response_body = local response_code, response_headers, response_status_line, response_body =
@ -42,8 +42,8 @@ function run(msg, matches)
end end
return { return {
description = "", description = "Sende Tweets auf Twitter! twitter.com/Mikubot_",
usage = "", usage = {"/tw [Text]"},
patterns = {"^/tw (.+)"}, patterns = {"^/tw (.+)"},
run = run, run = run,
} }

View File

@ -1,4 +1,3 @@
do do
function getWallpaper(text) function getWallpaper(text)

View File

@ -1,12 +1,12 @@
function run(msg, matches) function run(msg, matches)
local user_name = get_name(msg) local user_name = get_name(msg)
return "" .. user_name .. " ist wieder da" return user_name .. " ist wieder da"
end end
return { return {
description = "Sagt dass ihr wieder da seid", description = "Sagt dass ihr wieder da seid",
usage = {"/wd"}, usage = {"/wd"},
patterns = {"^/wd(.*)$"}, patterns = {"^/wd$"},
run = run run = run
} }
--by Akamaru --by Akamaru

View File

@ -33,7 +33,7 @@ end
return { return {
description = "Sendet YouTube-Info.", description = "Sendet YouTube-Info.",
usage = "", usage = {"youtube.com/watch Link","youtu.be Link"},
patterns = { patterns = {
"youtu.be/([A-Za-z0-9-_-]+)", "youtu.be/([A-Za-z0-9-_-]+)",
"youtube.com/watch%?v=([A-Za-z0-9-_-]+)", "youtube.com/watch%?v=([A-Za-z0-9-_-]+)",