This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot-2/otouto/plugins/site_header.lua
Andreas Bielawski 5d26c4289c - Portierung folgender Plugins:
+ Reddit_post
+ Eindeutschung von Reddit
+ Site_header
+ Soundcloud
+ Speedtest
+ Spotify
+ Surrogate
+ Tex
+ Xkcd
+ Yourls
- Plugin-Name wird nun angezeigt, wenn Bot getriggert wird
- Wie immer: kleine Änderungen
2016-06-20 17:58:46 +02:00

29 lines
689 B
Lua

local site_header = {}
local utilities = require('otouto.utilities')
function site_header:init(config)
site_header.triggers = {
"^/(head) ([%w-_%.%?%.:,/%+=&#!]+)$",
"^/(dig) ([%w-_%.%?%.:,/%+=&#!]+)$"
}
end
function site_header:action(msg, config, matches)
if msg.from.id ~= config.admin then
utilities.send_reply(self, msg, config.errors.sudo)
end
local url = matches[2]
if matches[1] == 'head' then
input = 'curl --head '..url
elseif matches[1] == 'dig' then
input = 'dig '..url..' ANY'
end
local output = io.popen(input):read('*all')
output = '```\n' .. output .. '\n```'
utilities.send_reply(self, msg, output, true)
end
return site_header