Updates & Fixes

banhammer.lua: Entferne prints
pihole.lua: Anpassung an Pi-hole 3.0
playstation_store.lua: Fix für falschen Namen
plex.lua: Anpassungen (Achtung, dreckig)
special.lua: "Kuma Shock"
Neu! get_img.lua
This commit is contained in:
Akamaru 2017-05-10 13:35:21 +02:00
parent 2e2f23c5c9
commit 8e0b6e0339
6 changed files with 54 additions and 38 deletions

View File

@ -141,19 +141,19 @@ function banhammer:pre_process(msg, config)
-- Allow all sudo users even if whitelist is allowed
if whitelist and not issudo then
print('Whitelist enabled and not sudo')
--print('Whitelist enabled and not sudo')
-- Check if user or chat is whitelisted
local allowed = banhammer:is_user_whitelisted(user_id)
local has_been_warned = redis:hget('user:'..user_id, 'has_been_warned')
if not allowed then
print('User '..user_id..' not whitelisted')
--print('User '..user_id..' not whitelisted')
if msg.chat.type == 'group' or msg.chat.type == 'supergroup' then
allowed = banhammer:is_chat_whitelisted(chat_id)
if not allowed then
print ('Chat '..chat_id..' not whitelisted')
--print ('Chat '..chat_id..' not whitelisted')
else
print ('Chat '..chat_id..' whitelisted :)')
--print ('Chat '..chat_id..' whitelisted :)')
end
else
if not has_been_warned then
@ -167,7 +167,7 @@ function banhammer:pre_process(msg, config)
end
end
else
print('User '..user_id..' allowed :)')
--print('User '..user_id..' allowed :)')
end
if not allowed then

26
miku/plugins/get_img.lua Normal file
View File

@ -0,0 +1,26 @@
local get_img = {}
function get_img:init(config)
get_img.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('getimg', true).table
get_img.doc = '\n*/getimg* _<URL>_'
end
get_img.command = 'getimg <URL>'
function get_img:action(msg, config)
local input = utilities.input_from_msg(msg)
if not input then
utilities.send_reply(msg, get_img.doc, true)
return
end
utilities.send_typing(msg.chat.id, 'upload_photo')
local img_url = download_to_file(input)
if not img_url then
utilities.send_reply(msg, config.errors.connection)
return
end
utilities.send_photo(msg.chat.id, input, nil, msg.message_id)
end
return get_img

View File

@ -1,33 +1,7 @@
local pihole = {}
function pihole:init(config)
pihole.triggers = {'/[Pp][Ii][Hh][Oo][Ll][ee]'}
end
function pihole:transeng(ger)
--Days
local ger = string.gsub(ger, "Monday", "Montag")
local ger = string.gsub(ger, "Tuesday", "Dienstag")
local ger = string.gsub(ger, "Wednesday", "Mittwoch")
local ger = string.gsub(ger, "Thursday", "Donnerstag")
local ger = string.gsub(ger, "Friday", "Freitag")
local ger = string.gsub(ger, "Saturday", "Samstag")
local ger = string.gsub(ger, "Sunday", "Sonntag")
--Months
local ger = string.gsub(ger, "January", "Januar")
local ger = string.gsub(ger, "February", "Februar")
local ger = string.gsub(ger, "March", "März")
local ger = string.gsub(ger, "April", "April")
local ger = string.gsub(ger, "May", "Mai")
local ger = string.gsub(ger, "June", "Juni")
local ger = string.gsub(ger, "July", "Juli")
local ger = string.gsub(ger, "August", "August")
local ger = string.gsub(ger, "September", "September")
local ger = string.gsub(ger, "October", "Oktober")
local ger = string.gsub(ger, "November", "November")
local ger = string.gsub(ger, "December", "Dezember")
return ger
pihole.triggers = {'^/[Pp][Ii][Hh][Oo][Ll][ee]'}
end
function pihole:get_pihole()
@ -36,12 +10,11 @@ function pihole:get_pihole()
if c ~= 200 then return nil end
local data = json.decode(b)
local time = os.date("%A den %d. %B %Y")
local domains_being_blocked = data.domains_being_blocked
local dns_queries_today = data.dns_queries_today
local ads_blocked_today = data.ads_blocked_today
local ads_percentage_today = data.ads_percentage_today
local text = '<b>Pi-Hole Statistik vom '..pihole:transeng(time)..'</b>\nGeblockte Domains: <i>'..domains_being_blocked..'</i>\nHeutige DNS-Abfragen: <i>'..dns_queries_today..'</i>\nGeblockte DNS-Abfragen: <i>'..ads_blocked_today..' ('..ads_percentage_today..'%)</i>'
local text = '<b>Pi-Hole Statistik der letzten 24h</b>\nGeblockte Domains: <i>'..domains_being_blocked..'</i>\nDNS-Abfragen: <i>'..dns_queries_today..'</i>\nGeblockte DNS-Abfragen: <i>'..ads_blocked_today..' ('..ads_percentage_today..'%)</i>'
return text
end

View File

@ -18,7 +18,7 @@ function playstation_store:get_info(country_code, game_id)
local data = json.decode(res)
if not data then return nil end
local title = data.title_name
local title = data.name
if data.provider_name then
publish = ' von '..data.provider_name
else
@ -34,6 +34,7 @@ function playstation_store:get_info(country_code, game_id)
else
types = ''
end
if data.skus then
if data.skus[1].rewards[1] then
--[[
@ -48,6 +49,9 @@ function playstation_store:get_info(country_code, game_id)
else
price = data.default_sku.display_price--..psplus
end
else
price = 'N/A'
end
local fsk = data.age_limit
local description = string.sub(unescape(data.long_desc:gsub("%b<>", "")), 1, 300)..'...'
local release = makeOurDate(data.release_date)

View File

@ -24,9 +24,10 @@ end
local DESC_LENTH = 400
local plex_token = cred_data.plex_token
local plex_addr = cred_data.plex_addr
function plex:get_plex(query)
local baseurl = 'http://hakase.local:32400' --replace it with yours
local baseurl = 'http://'..plex_addr..':32400'
local response_body = {}
local request_constructor = {
url = baseurl..'/search?query='..query..'&X-Plex-Token='..plex_token,
@ -147,7 +148,9 @@ function plex:get_plex(query)
else
pic = nil
end
local musicDate = date2:gsub('01.01.', '') --well ._.
if data.librarySectionTitle == 'Animes' then
text = title..from..studio..date1..episodes..fsk..duration..rating..desc
elseif data.librarySectionTitle == 'Cartoons' then
@ -156,8 +159,14 @@ function plex:get_plex(query)
text = title..tag..origtitle..studio..date2..fsk..duration..rating..desc
elseif data.librarySectionTitle == 'Filme' then
text = title..tag..origtitle..studio..date2..fsk..duration..rating..desc
elseif data.librarySectionTitle == 'Gronkh Streams' then
text = title..tag..origtitle..studio..date2..fsk..duration..rating..desc
elseif data.librarySectionTitle == 'Musik' then
text = title..artist..date2..desc
text = title..artist..musicDate..desc
elseif data.librarySectionTitle == 'Musik (Unsortiert!)' then
text = title..artist..musicDate..desc
elseif data.librarySectionTitle == 'Musikvideos' then
text = title..tag..origtitle..studio..date2..fsk..duration..rating..desc
elseif data.librarySectionTitle == 'Serien' then
text = title..from..studio..date1..episodes..fsk..duration..rating..desc
elseif data.librarySectionTitle == 'YouTube Serien' then

View File

@ -23,6 +23,7 @@ special.triggers = {
"^[Yy][Oo][Ss][Hh][Ii] [Dd][Aa][Nn][Cc][Ee] [Gg][Ll][Ii][Tt][Cc][Hh]",
"^[Yy][Oo][Ss][Hh][Ii] [Dd][Aa][Nn][Cc][Ee]",
"^[Nn][Oo][Pp][Ee].[Aa][Vv][Ii]",
"^[Kk][Uu][Mm][Aa] [Ss][Cc]?[Hh][Oo][Cc][Kk]",
"^[Ss][Uu][Gg][Oo][Ii] [Dd][Ee][Ss][Uu] [Nn][Ee]",
"^[Nn][Aa][Nn][Oo] [Hh][Aa][Kk][Aa][Ss][Ee]$",
"^/[Tt][Hh][Yy][Mm][Ee]$",
@ -109,6 +110,9 @@ function special:action(msg, config, matches)
elseif msg_text:match("[Nn][Oo][Pp][Ee].[Aa][Vv][Ii]") then
utilities.send_video(msg.chat.id, 'http://code.ponywave.de/workspace/test/fuck/nope.mp4', nil, msg.message_id)
return
elseif msg_text:match("[Kk][Uu][Mm][Aa] [Ss][Cc]?[Hh][Oo][Cc][Kk]") then
utilities.send_video(msg.chat.id, 'http://code.ponywave.de/workspace/test/fuck/KUMA_SHOCK.mp4', 'KUMA SHOCK!', msg.message_id)
return
elseif msg_text:match("[Ss][Uu][Gg][Oo][Ii] [Dd][Ee][Ss][Uu] [Nn][Ee]") then
utilities.send_video(msg.chat.id, 'http://code.ponywave.de/workspace/test/fuck/sugoidesune.mp4', 'eeeeee!?\nSUGOI DESU NE?', msg.message_id)
return