Kleine Änderungen und Bugfixes
- "if not is_sudo" Texte ausgetauscht - Pattern-Fix in google_books.lua - Dateipfad in Random Pic Plugins angepasst - sh.lua überarbeitet - Neues Pattern in youtube.lua - Fix für verschiedene Dateiendungen in youtube_dl.lua
This commit is contained in:
parent
5fd0a7d9b1
commit
5ce1042f6a
@ -2,7 +2,7 @@ package.path = './.luarocks/share/lua/5.2/?.lua;./.luarocks/share/lua/5.2/?/init
|
||||
require("luarocks.loader")
|
||||
require("./bot/utils")
|
||||
|
||||
VERSION = '20151205'
|
||||
VERSION = '20160623'
|
||||
|
||||
-- This function is called when tg receive a msg
|
||||
function on_msg_receive (msg)
|
||||
|
@ -413,7 +413,7 @@ end
|
||||
-- Returns true if user was warned and false if not warned (is allowed)
|
||||
function warns_user_not_allowed(plugin, msg)
|
||||
if not user_allowed(plugin, msg) then
|
||||
local text = 'Du darfst diesen Befehl nicht nutzen!'
|
||||
local text = 'Das darf nur mein Meister!'
|
||||
local receiver = get_receiver(msg)
|
||||
send_msg(receiver, text, ok_cb, false)
|
||||
return true
|
||||
|
@ -75,7 +75,7 @@ function run(msg, matches)
|
||||
local receiver = get_receiver(msg)
|
||||
|
||||
if not is_sudo(msg) then
|
||||
return 'Du bist kein Superuser. Dieser Vorfall wird gemeldet!'
|
||||
return 'Das darf nur mein Meister!'
|
||||
end
|
||||
|
||||
if msg.to.type == 'chat' then
|
||||
|
@ -62,8 +62,7 @@ end
|
||||
|
||||
return {
|
||||
description = "Sucht nach Büchern in Google Books.",
|
||||
usage = "
|
||||
#books [Suchbegriff]: Sucht nach Büchern in Google Books",
|
||||
usage = "#books [Suchbegriff]: Sucht nach Büchern in Google Books",
|
||||
patterns = {"^#books (.*)$"},
|
||||
run = run
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ local function run(msg, matches)
|
||||
return save_quote(msg)
|
||||
elseif matches[1] == "delquote" then
|
||||
if not is_sudo(msg) then
|
||||
return "Du bist kein Superuser. Dieser Vorfall wird gemeldet."
|
||||
return "Das darf nur mein Meister!"
|
||||
else
|
||||
return delete_quote(msg)
|
||||
end
|
||||
|
@ -8,13 +8,13 @@ end
|
||||
function run(msg, matches)
|
||||
local pics = {
|
||||
-- add more below!
|
||||
["test"] = "../Bilder/Mikubot/sfw/test/",
|
||||
["anime"] = "../Bilder/Mikubot/sfw/anime/",
|
||||
["mlp"] = "../Bilder/Mikubot/sfw/mlp/",
|
||||
["faktillon"] = "../Bilder/Mikubot/sfw/faktillon/",
|
||||
["faktastisch"] = "../Bilder/Mikubot/sfw/faktastisch/",
|
||||
["gamefakt"] = "../Bilder/Mikubot/sfw/gamefakt/",
|
||||
["faktglaublich"] = "../Bilder/Mikubot/sfw/faktglaublich/"
|
||||
["test"] = "../Festplatten/Dragoran/Mikubot/sfw/test/",
|
||||
["anime"] = "../Festplatten/Dragoran/Mikubot/sfw/anime/",
|
||||
["mlp"] = "../Festplatten/Dragoran/Mikubot/sfw/mlp/",
|
||||
["faktillon"] = "../Festplatten/Dragoran/Mikubot/sfw/faktillon/",
|
||||
["faktastisch"] = "../Festplatten/Dragoran/Mikubot/sfw/faktastisch/",
|
||||
["gamefakt"] = "../Festplatten/Dragoran/Mikubot/sfw/gamefakt/",
|
||||
["faktglaublich"] = "../Festplatten/Dragoran/Mikubot/sfw/faktglaublich/"
|
||||
}
|
||||
|
||||
local receiver = get_receiver(msg)
|
||||
|
@ -8,9 +8,10 @@ end
|
||||
function run(msg, matches)
|
||||
local pics = {
|
||||
-- add more below!
|
||||
["#nsfw"] = "../Bilder/Mikubot/nsfw/",
|
||||
["#nsfw gif"] = "../Bilder/Mikubot/nsfw/gifs/",
|
||||
["#nsfw shimakaze"] = "../Bilder/Mikubot/nsfw/Shimakaze/"
|
||||
["#nsfw"] = "../Festplatten/Dragoran/Mikubot/nsfw/",
|
||||
["#nsfw gif"] = "../Festplatten/Dragoran/Mikubot/nsfw/gifs/",
|
||||
["#nsfw rl"] = "../Festplatten/Dragoran/Mikubot/nsfw/rl/",
|
||||
["#nsfw shimakaze"] = "../Festplatten/Dragoran/Mikubot/nsfw/Shimakaze/"
|
||||
}
|
||||
|
||||
local receiver = get_receiver(msg)
|
||||
@ -27,14 +28,14 @@ function run(msg, matches)
|
||||
return "Fehler: " .. img
|
||||
end
|
||||
else
|
||||
return '"'..imgtype..'" gibt es nicht.\n/nsfw\n/nsfw gif\n/nsfw shimakaze'
|
||||
return '"'..imgtype..'" gibt es nicht.\n#nsfw\n#nsfw gif\n#nsfw rl\n#nsfw shimakaze'
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
description = "Sendet ein zufälliges Bild (NSFW)",
|
||||
usage = {"#nsfw","#nsfw gif","#nsfw shimakaze"},
|
||||
patterns = {"^#nsfw$","^#nsfw gif$","^#nsfw shimakaze$"},
|
||||
usage = {"#nsfw","#nsfw gif","#nsfw rl","#nsfw shimakaze"},
|
||||
patterns = {"^#nsfw$","^#nsfw gif$","^#nsfw rl$","^#nsfw shimakaze$"},
|
||||
run = run
|
||||
}
|
||||
end
|
||||
|
@ -1,4 +1,17 @@
|
||||
function run(msg, matches)
|
||||
local function transeng(ger)
|
||||
ger = string.gsub(ger, 'week,', 'Woche')
|
||||
ger = string.gsub(ger, 'weeks,', 'Wochen')
|
||||
ger = string.gsub(ger, 'day,', 'Tag')
|
||||
ger = string.gsub(ger, 'days,', 'Tage')
|
||||
ger = string.gsub(ger, 'hour,', 'Stunde')
|
||||
ger = string.gsub(ger, 'hours,', 'Stunden')
|
||||
ger = string.gsub(ger, 'minute$', 'Minute')
|
||||
ger = string.gsub(ger, 'minutes', 'Minuten')
|
||||
|
||||
return ger
|
||||
end
|
||||
|
||||
local function run(msg, matches)
|
||||
local receiver = get_receiver(msg)
|
||||
|
||||
if string.match(msg.text, '^#[Ss][Hh]') then
|
||||
@ -8,9 +21,9 @@ function run(msg, matches)
|
||||
end
|
||||
|
||||
if string.match(msg.text, '^#[Uu][Pp][Tt][Ii][Mm][Ee]$') then
|
||||
text = run_bash('uptime')
|
||||
send_msg(receiver, text, ok_cb, false)
|
||||
return
|
||||
cmd = run_bash('uptime -p')
|
||||
text = transeng('Der PC ist seit '..string.match(cmd, 'up (.*)')..' an')
|
||||
return text
|
||||
end
|
||||
|
||||
-- Requires scrot (sudo apt-get install scrot)
|
||||
@ -26,44 +39,12 @@ function run(msg, matches)
|
||||
send_photo(get_receiver(msg), "tmp/webcam.png", ok_cb, false)
|
||||
end
|
||||
|
||||
-- You need to disable sudo password
|
||||
if string.match(msg.text, '^#[Uu][Pp][Dd][Aa][Tt][Ee]$') then
|
||||
text = run_bash("sudo apt-get update")
|
||||
print(text)
|
||||
return 'Update durchgeführt!'
|
||||
end
|
||||
|
||||
if string.match(msg.text, '^#[Uu][Pp][Gg][Rr][Aa][Dd][Ee]$') then
|
||||
text = run_bash("sudo apt-get upgrade -y")
|
||||
print(text)
|
||||
return 'Upgrade durchgeführt!'
|
||||
end
|
||||
|
||||
if string.match(msg.text, '^#[Cc][Hh][Ee][Cc][Kk]$') then
|
||||
cmd = run_bash("sudo apt-get --just-print upgrade")
|
||||
cmd = run_bash("apt --just-print upgrade")
|
||||
text = 'Es gibt '..string.match(cmd, '(%d+) aktualisiert')..' Updates'
|
||||
return text
|
||||
end
|
||||
|
||||
-- vcgencmd works only on Raspberry Pi
|
||||
if string.match(msg.text, '^#[Tt][Ee][Mm][Pp]$') then
|
||||
text = run_bash('vcgencmd measure_temp')
|
||||
text = string.gsub(text, "temp=", " ")
|
||||
return "Die CPU Temperatur beträgt" ..text
|
||||
end
|
||||
|
||||
if string.match(msg.text, '^#[Vv][Oo][Ll][Tt]$') then
|
||||
text = run_bash('vcgencmd measure_volts')
|
||||
send_msg(receiver, text, ok_cb, false)
|
||||
return
|
||||
end
|
||||
|
||||
if string.match(msg.text, '^#[Tt][Aa][Kk][Tt]$') then
|
||||
text = run_bash('vcgencmd measure_clock arm')
|
||||
send_msg(receiver, text, ok_cb, false)
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return {
|
||||
@ -72,11 +53,6 @@ return {
|
||||
patterns = {"^#[Ss][Hh] (.*)$",
|
||||
"^#[Uu][Pp][Tt][Ii][Mm][Ee]$",
|
||||
"^#[Ss][Cc][Rr][Ee][Ee][Nn]$",
|
||||
"^#[Uu][Pp][Dd][Aa][Tt][Ee]$",
|
||||
"^#[Uu][Pp][Gg][Rr][Aa][Dd][Ee]$",
|
||||
"^#[Tt][Ee][Mm][Pp]$",
|
||||
"^#[Vv][Oo][Ll][Tt]$",
|
||||
"^#[Tt][Aa][Kk][Tt]$",
|
||||
"^#[Cc][Hh][Ee][Cc][Kk]$",
|
||||
"^#[Ww][Ee][Bb][Cc][Aa][Mm]$"
|
||||
},
|
||||
|
@ -138,6 +138,7 @@ return {
|
||||
patterns = {
|
||||
"youtu.be/([A-Za-z0-9-_-]+)",
|
||||
"youtube.com/watch%?v=([A-Za-z0-9-_-]+)",
|
||||
"youtube.com/embed/([A-Za-z0-9-_-]+)",
|
||||
"c3nt.de/lor/([A-Za-z0-9-_-]+)"
|
||||
},
|
||||
run = run
|
||||
|
@ -10,11 +10,11 @@ function run(msg, matches)
|
||||
|
||||
if string.match(msg.text, "#mp4") then
|
||||
text = run_bash('youtube-dl -o "tmp/%(title)s.%(ext)s" '..URL)
|
||||
video = string.match(text, 'Merging formats into "tmp/(.*).mp4"')
|
||||
video = string.match(text, 'Merging formats into "tmp/(.*)"')
|
||||
if not video then
|
||||
file = string.match(text, '%[download%] (.*) has already been downloaded')
|
||||
else
|
||||
file = 'tmp/'..video..'.mp4'
|
||||
file = 'tmp/'..video
|
||||
end
|
||||
send_video(get_receiver(msg), file, ok_cb, false)
|
||||
end
|
||||
|
Reference in New Issue
Block a user