- Portiere AFK-Plugin

- Portiere pre_process()
- GImages: GIFs werden als Dokumente gesendet
This commit is contained in:
Andreas Bielawski
2016-06-15 20:10:30 +02:00
parent c4362b2196
commit 74b130f21e
3 changed files with 138 additions and 1 deletions

View File

@ -63,12 +63,14 @@ function bot:on_msg_receive(msg, config) -- The fn run whenever a message is rec
if msg.date < os.time() - 5 then return end -- Do not process old messages.
msg = utilities.enrich_message(msg)
if msg.text:match('^'..config.cmd_pat..'start .+') then
msg.text = config.cmd_pat .. utilities.input(msg.text)
msg.text_lower = msg.text:lower()
end
pre_process_msg(self, msg)
for _, plugin in ipairs(self.plugins) do
for _, trigger in pairs(plugin.triggers) do
if string.match(msg.text_lower, trigger) then
@ -144,6 +146,16 @@ function bot:run(config)
print('Halted.')
end
-- Apply plugin.pre_process function
function pre_process_msg(self, msg)
for number,plugin in ipairs(self.plugins) do
if plugin.pre_process and msg then
print('Preprocess #'..number)
plugin:pre_process(msg, self)
end
end
end
function load_cred()
if redis:exists("telegram:credentials") == false then
-- If credentials hash doesnt exists