diff --git a/bot/utils.lua b/bot/utils.lua index 578795c..4dfc7ca 100644 --- a/bot/utils.lua +++ b/bot/utils.lua @@ -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, " ", " ") @@ -835,4 +836,4 @@ function convert_timestamp(timestamp, format) local converted_date = run_command('date -d @'..timestamp..' +'..format) local converted_date = string.gsub(converted_date, '%\n', '') return converted_date - end \ No newline at end of file + end diff --git a/plugins/images.lua b/plugins/images.lua index 9d64563..ad1a37a 100644 --- a/plugins/images.lua +++ b/plugins/images.lua @@ -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 } diff --git a/plugins/plex.lua b/plugins/plex.lua index 7d6f3f1..fd35089 100644 --- a/plugins/plex.lua +++ b/plugins/plex.lua @@ -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, @@ -134,4 +134,4 @@ return { run = run } -end \ No newline at end of file +end diff --git a/plugins/sh.lua b/plugins/sh.lua index c28aba7..46520a1 100644 --- a/plugins/sh.lua +++ b/plugins/sh.lua @@ -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 diff --git a/plugins/soundboard.lua b/plugins/soundboard.lua index 25ef2e0..f136b0a 100644 --- a/plugins/soundboard.lua +++ b/plugins/soundboard.lua @@ -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} @@ -35,4 +36,4 @@ return { } end ---by Akamaru [https://ponywave.de] \ No newline at end of file +--by Akamaru [https://ponywave.de] diff --git a/plugins/stille.lua b/plugins/stille.lua index 0f5c171..a32dffe 100644 --- a/plugins/stille.lua +++ b/plugins/stille.lua @@ -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 diff --git a/plugins/weather.lua b/plugins/weather.lua index fd61814..8a4d68e 100644 --- a/plugins/weather.lua +++ b/plugins/weather.lua @@ -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 = { @@ -129,4 +129,4 @@ return { run = run } -end \ No newline at end of file +end