Kleine Fixes

This commit is contained in:
Akamaru 2017-08-14 23:39:44 +02:00
parent 132a637e60
commit 8c5d23a292
3 changed files with 8 additions and 8 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ miku/plugins/link_warning.lua
luarocks
miku/plugins/gTrendDoge.lua
miku/plugins/xrel_search.lua
reversed.mp4

View File

@ -5,7 +5,7 @@ preview.command = 'preview <link>'
function preview:init(config)
preview.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('preview', true).table
preview.inline_triggers = {
"^pr (https?://[%w-_%.%?%.,:;/%+=&%~%%#]+)$"
"^[Pp][Rr] (https?://[%w-_%.%?%.,:;/%+=&%~%%#]+)$"
}
preview.doc = [[*
]]..config.cmd_pat..[[preview* _<URL>_

View File

@ -20,7 +20,6 @@ function shell:transeng(ger)
local ger = string.gsub(ger, "Friday", "Freitag")
local ger = string.gsub(ger, "Saturday", "Samstag")
local ger = string.gsub(ger, "Sunday", "Sonntag")
--Weeks
local ger = string.gsub(ger, 'week,', 'Woche,')
local ger = string.gsub(ger, 'weeks,', 'Wochen,')
@ -30,7 +29,6 @@ function shell:transeng(ger)
local ger = string.gsub(ger, 'hours,', 'Stunden und')
local ger = string.gsub(ger, 'minute$', 'Minute.')
local ger = string.gsub(ger, 'minutes', 'Minuten.')
--Months
local ger = string.gsub(ger, "January", "Januar")
local ger = string.gsub(ger, "February", "Februar")
@ -60,6 +58,7 @@ function shell:action(msg, config, matches)
end
local input = matches[1]
local taken_time = os.date("%A, %d. %B %Y um %H:%M:%S Uhr")
if msg.text:match('^/[Uu][Pp][Tt][Ii][Mm][Ee]$') then
local cmd = run_command('uptime -s && uptime -p')
@ -71,8 +70,7 @@ function shell:action(msg, config, matches)
-- Requires scrot (sudo apt-get install scrot)
if msg.text:match('^/[Ss][Cc][Rr][Ee][Ee][Nn]$') then
local taken_time = os.date("%A, %d. %B %Y um %H:%M:%S Uhr")
run_command("scrot 'scrot.png' -e 'mv $f /tmp/'")
run_command("scrot '/tmp/scrot.png'")
local text = '#Screenshot vom '..shell:transeng(taken_time)
utilities.send_photo(msg.chat.id, '/tmp/scrot.png', text, msg.message_id)
return
@ -81,13 +79,14 @@ function shell:action(msg, config, matches)
-- Requires fswebcam (sudo apt-get install fswebcam)
if msg.text:match('^/[Ww][Ee][Bb][Cc][Aa][Mm]$') then
run_command("fswebcam -r 1280x1024 --png 9 -D 1 /tmp/webcam.png")
utilities.send_photo(msg.chat.id, '/tmp/webcam.png', nil, msg.message_id)
local text = '#Webcam vom '..shell:transeng(taken_time)
utilities.send_photo(msg.chat.id, '/tmp/webcam.png', text, msg.message_id)
return
end
if msg.text:match('^/[Cc][Hh][Ee][Cc][Kk]$') then
local cmd = run_command("apt --just-print upgrade")
local text = 'Es gibt <b>'..string.match(cmd, '(%d+) aktualisiert')..'</b> Updates'
local text = 'Es gibt <b>'..string.match(cmd, '(%d+) aktualisiert')..'</b> Updates.'
utilities.send_reply(msg, text, 'HTML')
return
end