Akamaru
8e0b6e0339
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
32 lines
1.0 KiB
Lua
32 lines
1.0 KiB
Lua
local pihole = {}
|
|
|
|
function pihole:init(config)
|
|
pihole.triggers = {'^/[Pp][Ii][Hh][Oo][Ll][ee]'}
|
|
end
|
|
|
|
function pihole:get_pihole()
|
|
local url = 'http://nibutani.local/admin/api.php'
|
|
local b,c = http.request(url)
|
|
if c ~= 200 then return nil end
|
|
local data = json.decode(b)
|
|
|
|
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 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
|
|
|
|
function pihole:action(msg, config, matches)
|
|
local text = pihole:get_pihole()
|
|
if not text then
|
|
utilities.send_reply(msg, config.errors.results)
|
|
return
|
|
end
|
|
|
|
utilities.send_message(msg.chat.id, text, false, msg.message_id, 'html')
|
|
end
|
|
|
|
return pihole
|