german translation on bot.lua

This commit is contained in:
Akamaru 2015-05-09 16:35:22 +02:00
parent 90428735d3
commit a38049eb00

View File

@ -78,7 +78,7 @@ end
-- will get the text after the last "/" for filename -- will get the text after the last "/" for filename
-- and content-type for extension -- and content-type for extension
function download_to_file(url, file_name) function download_to_file(url, file_name)
print("url to download: "..url) print("Download URL: "..url)
local respbody = {} local respbody = {}
local options = { local options = {
@ -106,7 +106,7 @@ function download_to_file(url, file_name)
file_name = file_name or get_http_file_name(url, headers) file_name = file_name or get_http_file_name(url, headers)
local file_path = "/home/pi/Mikubot/tmp/"..file_name local file_path = "/home/pi/Mikubot/tmp/"..file_name
print("Saved to: "..file_path) print("Gespeichert in: "..file_path)
file = io.open(file_path, "w+") file = io.open(file_path, "w+")
file:write(table.concat(respbody)) file:write(table.concat(respbody))
@ -253,10 +253,10 @@ function send_photo_from_url(receiver, url, cb_function, cb_extra)
local file_path = download_to_file(url, false) local file_path = download_to_file(url, false)
if not file_path then -- Error if not file_path then -- Error
local text = 'Error downloading the image' local text = 'Fehler beim laden des Bildes'
send_msg(receiver, text, cb_function, cb_extra) send_msg(receiver, text, cb_function, cb_extra)
else else
print("File path: "..file_path) print("Datei Pfad: "..file_path)
_send_photo(receiver, file_path, cb_function, cb_extra) _send_photo(receiver, file_path, cb_function, cb_extra)
end end
end end
@ -268,10 +268,10 @@ function send_photo_from_url_callback(cb_extra, success, result)
local file_path = download_to_file(url, false) local file_path = download_to_file(url, false)
if not file_path then -- Error if not file_path then -- Error
local text = 'Error downloading the image' local text = 'Fehler beim laden des Bildes'
send_msg(receiver, text, ok_cb, false) send_msg(receiver, text, ok_cb, false)
else else
print("File path: "..file_path) print("Datei Pfad: "..file_path)
_send_photo(receiver, file_path, ok_cb, false) _send_photo(receiver, file_path, ok_cb, false)
end end
end end
@ -298,7 +298,7 @@ function send_photos_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(remove_path.." gelöscht!")
end end
-- Nil or empty, exit case (no more urls) -- Nil or empty, exit case (no more urls)
@ -328,7 +328,7 @@ function rmtmp_cb(cb_extra, success, result)
if file_path ~= nil then if file_path ~= nil then
os.remove(file_path) os.remove(file_path)
print("Deleted: "..file_path) print(file_path.." gelöscht!")
end end
-- Finaly call the callback -- Finaly call the callback
cb_function(cb_extra, success, result) cb_function(cb_extra, success, result)
@ -350,7 +350,7 @@ end
-- cb_function and cb_extra are optionals callback -- cb_function and cb_extra are optionals callback
function send_document_from_url(receiver, url, cb_function, cb_extra) function send_document_from_url(receiver, url, cb_function, cb_extra)
local file_path = download_to_file(url, false) local file_path = download_to_file(url, false)
print("File path: "..file_path) print("Datei Pfad: "..file_path)
_send_document(receiver, file_path, cb_function, cb_extra) _send_document(receiver, file_path, cb_function, cb_extra)
end end
@ -377,7 +377,7 @@ end
-- Returns true if user was warned and false if not warned (is allowed) -- Returns true if user was warned and false if not warned (is allowed)
function warns_user_not_allowed(plugin, msg) function warns_user_not_allowed(plugin, msg)
if not user_allowed(plugin, msg) then if not user_allowed(plugin, msg) then
local text = 'This plugin requires privileged user' local text = 'Du darfst diesen Befehl nicht nutzen!'
local receiver = get_receiver(msg) local receiver = get_receiver(msg)
send_msg(receiver, text, ok_cb, false) send_msg(receiver, text, ok_cb, false)
return true return true
@ -451,9 +451,9 @@ function load_from_file(file)
if f == nil then if f == nil then
-- Create a new empty table -- Create a new empty table
serialize_to_file({}, file) serialize_to_file({}, file)
print ('Created file', file) print ('Erstelle Datei', file)
else else
print ('Data loaded from file', file) print ('Daten geladen von', file)
f:close() f:close()
end end
return loadfile (file)() return loadfile (file)()