patterns overwritten

This commit is contained in:
Akamaru 2015-08-17 18:58:11 +02:00
parent 5193f88e6a
commit 8430ddd168
6 changed files with 85 additions and 81 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
pictures/squid.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -1,38 +1,34 @@
function run(msg, matches)
if string.starts(msg.text, '/shiina') or string.starts(msg.text, "/Shiina") then
if string.match(msg.text, '^/[Ss][Hh][Ii][Ii][Nn][Aa]$') then
send_photo(get_receiver(msg), "pictures/sakurasou/shiina.jpg", ok_cb, false)
end
if string.starts(msg.text, '/chihiro') or string.starts(msg.text, "/Chihiro") then
elseif string.match(msg.text, '^/[Cc][Hh][Ii][Hh][Ii][Rr][Oo]$') then
send_photo(get_receiver(msg), "pictures/sakurasou/chihiro.jpg", ok_cb, false)
end
if string.starts(msg.text, '/jin') or string.starts(msg.text, "/Jin") then
elseif string.match(msg.text, '^/[Jj][Ii][Nn]$') then
send_photo(get_receiver(msg), "pictures/sakurasou/jin.jpg", ok_cb, false)
end
if string.starts(msg.text, '/misaki') or string.starts(msg.text, "/Misaki") then
elseif string.match(msg.text, '^/[Mm][Ii][Ss][Aa][Kk][Ii]$') then
send_photo(get_receiver(msg), "pictures/sakurasou/misaki.jpg", ok_cb, false)
end
if string.starts(msg.text, '/nanami') or string.starts(msg.text, "/Nanami") then
elseif string.match(msg.text, '^/[Nn][Aa][Nn][Aa][Mm][Ii]$') then
send_photo(get_receiver(msg), "pictures/sakurasou/nanami.jpg", ok_cb, false)
end
if string.starts(msg.text, '/ryuunosuke') or string.starts(msg.text, "/Ryuunosuke") then
elseif string.match(msg.text, '^/[Rr][Yy][Uu][Uu][Nn][Oo][Ss][Uu][Kk][Ee]$') then
send_photo(get_receiver(msg), "pictures/sakurasou/ryuunosuke.jpg", ok_cb, false)
end
if string.starts(msg.text, '/sorata') or string.starts(msg.text, "/Sorata") then
elseif string.match(msg.text, '^/[Ss][Oo][Rr][Aa][Tt][Aa]$') then
send_photo(get_receiver(msg), "pictures/sakurasou/sorata.jpg", ok_cb, false)
end
end
end
return {
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"},
patterns = {"^/shiina$","^/Shiina$","^/chihiro$","^/Chihiro$","^/jin$","^/Jin$","^/misaki$","^/Misaki$","^/nanami$","^/Nanami$","^/ryuunosuke$","^/Ryuunosuke$","^/sorata$","^/Sorata$"},
usage = {"/Shiina","/Chihiro","/Jin","/Misaki","/Nanami","/Ryuunosuke","/Sorata"},
patterns = {'^/[Ss][Hh][Ii][Ii][Nn][Aa]$',
'^/[Cc][Hh][Ii][Hh][Ii][Rr][Oo]$',
'^/[Jj][Ii][Nn]$',
'^/[Mm][Ii][Ss][Aa][Kk][Ii]$',
'^/[Nn][Aa][Nn][Aa][Mm][Ii]$',
'^/[Rr][Yy][Uu][Uu][Nn][Oo][Ss][Uu][Kk][Ee]$',
'^/[Ss][Oo][Rr][Aa][Tt][Aa]$'
},
run = run
}
--by Akamaru [https://ponywave.de]

View File

@ -1,46 +1,42 @@
function run(msg, matches)
if string.starts(msg.text, '/asuka') or string.starts(msg.text, "/Asuka") then
if string.match(msg.text, '^/[Aa][Ss][Uu][Kk][Aa]$') then
send_photo(get_receiver(msg), "pictures/senrankagura/hanzouacademy/asuka.jpg", ok_cb, false)
end
if string.starts(msg.text, '/hibari') or string.starts(msg.text, "/Hibari") then
elseif string.match(msg.text, '^/[Hh][Ii][Bb][Aa][Rr][Ii]$') then
send_photo(get_receiver(msg), "pictures/senrankagura/hanzouacademy/hibari.jpg", ok_cb, false)
end
if string.starts(msg.text, '/ikaruga') or string.starts(msg.text, "/Ikaruga") then
send_photo(get_receiver(msg), "pictures/senrankagura/hanzouacademy/ikaruga.jpg", ok_cb, false)
end
if string.starts(msg.text, '/katsuragi') or string.starts(msg.text, "/Katsuragi") then
send_photo(get_receiver(msg), "pictures/senrankagura/hanzouacademy/katsuragi.jpg", ok_cb, false)
end
if string.starts(msg.text, '/haruka') or string.starts(msg.text, "/Haruka") then
send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/haruka.jpg", ok_cb, false)
end
if string.starts(msg.text, '/hikage') or string.starts(msg.text, "/Hikage") then
send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/hikage.jpg", ok_cb, false)
end
if string.starts(msg.text, '/homura') or string.starts(msg.text, "/Homura") then
send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/homura.jpg", ok_cb, false)
end
if string.starts(msg.text, '/mirai') or string.starts(msg.text, "/Mirai") then
send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/mirai.jpg", ok_cb, false)
end
if string.starts(msg.text, '/yomi') or string.starts(msg.text, "/Yomi") then
elseif string.match(msg.text, '^/[Ii][Kk][Aa][Gg][Uu][Rr][Aa]$') then
send_photo(get_receiver(msg), "pictures/senrankagura/hanzouacademy/ikaruga.jpg", ok_cb, false)
elseif string.match(msg.text, '^/[Kk][Aa][Tt][Ss][Uu][Rr][Aa][Gg][Ii]$') then
send_photo(get_receiver(msg), "pictures/senrankagura/hanzouacademy/katsuragi.jpg", ok_cb, false)
--elseif string.match(msg.text, '^/[Yy][Aa][Gg][Yy][Uu][Uu]$') then
--send_photo(get_receiver(msg), "pictures/senrankagura/hanzouacademy/yagyuu.jpg", ok_cb, false)
elseif string.match(msg.text, '^/[Hh][Aa][Rr][Uu][Gg][Aa]$') then
send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/haruka.jpg", ok_cb, false)
elseif string.match(msg.text, '^/[Hh][Ii][Kk][Aa][Gg][Ee]$') then
send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/hikage.jpg", ok_cb, false)
elseif string.match(msg.text, '^/[Hh][Oo][Mm][Uu][Rr][Aa]$') then
send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/homura.jpg", ok_cb, false)
elseif string.match(msg.text, '^/[Mm][Ii][Rr][Aa][Ii]$') then
send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/mirai.jpg", ok_cb, false)
elseif string.match(msg.text, '^/[Yy][Oo][Mm][Ii]$') then
send_photo(get_receiver(msg), "pictures/senrankagura/hebijoacademy/yomi.jpg", ok_cb, false)
end
end
return {
description = "Sendet euch ein Senran Kagura Charakter",
usage = {"/asuka","/Asuka","/hibari","/Hibari","/ikaruga","/Ikaruga","/katsuragi","/Katsuragi","/haruka","/Haruka","/hikage","/Hikage","/homura","/Homura","/mirai","/Mirai","/yomi","/Yomi"},
patterns = {"^/asuka","^/Asuka","^/hibari","^/Hibari","^/ikaruga","^/Ikaruga","^/katsuragi","^/Katsuragi","^/haruka","^/Haruka","^/hikage","^/Hikage","^/homura","^/Homura","^/mirai","^/Mirai","^/yomi","^/Yomi"},
usage = {"/asuka","/hibari","/ikaruga","/katsuragi","/haruka","/hikage","/homura","/mirai","/yomi"},
patterns = {'^/[Aa][Ss][Uu][Kk][Aa]$',
'^/[Hh][Ii][Bb][Aa][Rr][Ii]$',
'^/[Ii][Kk][Aa][Gg][Uu][Rr][Aa]$',
'^/[Kk][Aa][Tt][Ss][Uu][Rr][Aa][Gg][Ii]$',
--'^/[Yy][Aa][Gg][Yy][Uu][Uu]$',
'^/[Hh][Aa][Rr][Uu][Gg][Aa]$',
'^/[Hh][Ii][Kk][Aa][Gg][Ee]$',
'^/[Hh][Oo][Mm][Uu][Rr][Aa]$',
'^/[Mm][Ii][Rr][Aa][Ii]$',
'^/[Yy][Oo][Mm][Ii]$'
},
run = run
}
--by Akamaru [https://ponywave.de]

View File

@ -1,59 +1,71 @@
function run(msg, matches)
local receiver = get_receiver(msg)
if string.starts(msg.text, '/sh') then
if string.match(msg.text, '^/[Ss][Hh]') then
text = run_sh(msg)
send_msg(receiver, text, ok_cb, false)
return
end
if string.starts(msg.text, '/uptime') then
if string.match(msg.text, '^/[Uu][Pp][Tt][Ii][Mm][Ee]$') then
text = run_bash('uptime')
send_msg(receiver, text, ok_cb, false)
return
end
if string.starts(msg.text, '/temp') then
text = run_bash('vcgencmd measure_temp')
text = string.gsub(text, "temp=", " ")
return "Die CPU Temperatur beträgt" ..text
end
if string.starts(msg.text, '/volt') then
text = run_bash('vcgencmd measure_volts')
send_msg(receiver, text, ok_cb, false)
return
end
if string.starts(msg.text, '/takt') then
text = run_bash('vcgencmd measure_clock arm')
send_msg(receiver, text, ok_cb, false)
return
end
if string.starts(msg.text, '/screen') then
-- Requires scrot (sudo apt-get install scrot)
if string.match(msg.text, '^/[Ss][Cc][Rr][Ee][Ee][Nn]$') then
text = run_bash("scrot 'scrot.png' -e 'mv $f ~/Mikubot/tmp/'")
send_photo(get_receiver(msg), "tmp/scrot.png", ok_cb, false)
return 'Screenshot wird gesendet!'
end
if string.starts(msg.text, '/update') then
-- 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.starts(msg.text, '/upgrade') then
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
-- 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 {
description = "Führt Befehle in der Konsole aus",
usage = {"/sh kann nur Akamaru"},
patterns = {"^/uptime$","^/sh (.*)$","^/temp$","^/volt$","^/takt$","^/screen$","^/update$","^/upgrade$"},
usage = {"/sh [Befehl]","/uptime","/temp","/volt","/takt","/screen","/update","/upgrade"},
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]$"
},
run = run,
privileged = true
}

View File

@ -14,7 +14,7 @@ end
return {
description = "Es ist so still hier",
usage = {"Stille","*Stille*"},
patterns = {"^[Ss][Tt][Ii][Ll][Ll][Ee].?$","^(*)[Ss][Tt][Ii][Ll][Ll][Ee](*)$"},
patterns = {"^[Ss][Tt][IiUu][Ll][Ll][Ee].?$","^(*)[Ss][Tt][Ii][Ll][Ll][Ee](*)$"},
run = run
}
end