Kleine Fixes und Stabilitätsverbesserungen

This commit is contained in:
Akamaru 2016-06-01 20:46:40 +02:00
parent 964170eb3e
commit a3a185abdb
7 changed files with 22 additions and 13 deletions

View File

@ -547,6 +547,7 @@ function unescape(str)
str = string.gsub(str, "™", "")
str = string.gsub(str, "&", "&")
str = string.gsub(str, "'", "'")
str = string.gsub(str, """, '"')
str = string.gsub(str, "'", "'")
str = string.gsub(str, "|", "|")
str = string.gsub(str, " ", " ")

View File

@ -10,8 +10,8 @@ end
return {
description = "Wenn ein Link zu einem Bild gesendet wird, läd und sendet der Bot das Bild.",
usage = {"Link zum Bild"},
patterns = {"^(https?://[%w-_%.%?%.:/%+=~&%[%]]+%.[Pp][Nn][Gg])",
"^(https?://[%w-_%.%?%.:/%+=~&%[%]]+%.[Jj][Pp][Ee]?[Gg])"},
patterns = {"^(https?://[%w-_%%%.%?%.:/%+=~&%[%]]+%.[Pp][Nn][Gg])",
"^(https?://[%w-_%%%.%?%.:/%+=~&%[%]]+%.[Jj][Pp][Ee]?[Gg])"},
run = run
}

View File

@ -14,7 +14,7 @@ end
local function get_plex(query)
local token = cred_data.plex_token
local baseurl = 'http://yagyuu.local:32400' --replace it with yours
local baseurl = 'http://kyouko.local:32400' --replace it with yours
local response_body = {}
local request_constructor = {
url = baseurl..'/search?query='..query..'&X-Plex-Token='..token,

View File

@ -20,6 +20,12 @@ function run(msg, matches)
return 'Screenshot wird gesendet!'
end
-- Requires ffmpeg (sudo apt-get install ffmpeg)
if string.match(msg.text, '^/[Ww][Ee][Bb][Cc][Aa][Mm]$') then
text = run_bash("ffmpeg -f video4linux2 -s 640x480 -r 1 -i /dev/video0 -vframes 1 -f image2 ~/Mikubot/tmp/webcam.jpg -y")
send_photo(get_receiver(msg), "tmp/webcam.jpg", 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")
@ -71,7 +77,8 @@ return {
"^/[Tt][Ee][Mm][Pp]$",
"^/[Vv][Oo][Ll][Tt]$",
"^/[Tt][Aa][Kk][Tt]$",
"^/[Cc][Hh][Ee][Cc][Kk]$"
"^/[Cc][Hh][Ee][Cc][Kk]$",
"^/[Ww][Ee][Bb][Cc][Aa][Mm]$"
},
run = run,
privileged = true

View File

@ -2,7 +2,8 @@ do
local function run(msg, matches)
local receiver = get_receiver(msg)
local url = "http://code.ponywave.de/workspace/mikubot/sounds/"..matches[1]..".mp3"
--local url = "http://code.ponywave.de/workspace/mikubot/sounds/"..matches[1]..".mp3"
local url = "http://kyouko.local/sounds/"..matches[1]..".mp3"
local file = download_to_file(url)
local cb_extra = {file_path=file}

View File

@ -62,7 +62,7 @@ local function list_stilles(msg)
end
local function run(msg, matches)
if string.match(msg.text, '^[Ss][Tt][IiUu][Ll][Ll][Ee].?$') then
if string.match(msg.text, '^*?[Ss][Tt][IiUu][Ll][Ll][Ee].?*?$') then
return get_stille(msg)
elseif matches[1] == "addstille" then
if not is_sudo(msg) then
@ -93,7 +93,7 @@ return {
patterns = {
"^/(delstille) (.+)$",
"^/(addstille) (.+)$",
"^[Ss][Tt][IiUu][Ll][Ll][Ee].?$",
"^*?[Ss][Tt][IiUu][Ll][Ll][Ee].?*?$",
"^/(liststille)$"
},
run = run

View File

@ -71,7 +71,7 @@ local function get_weather(lat, lng)
local text = temp..conditions..windspeed
if temperature == feelslike then
if temperature ~= feelslike then
text = text..'\n(gefühlt: '..feelslike..' °C)'
end
@ -117,7 +117,7 @@ end
return {
description = "Wetter für deinen oder einen gewählten Ort",
usage = {
"/wetter: Wetter für deinen Wohnort (/location set [Ort])",
"/wetter: Wetter für deinen Wohnort (!location set [Ort])",
"/wetter (Stadt): Wetter für diese Stadt"
},
patterns = {