blacklist.lua: Will now leave a blacklisted group.

This commit is contained in:
topkecleon 2016-07-15 15:24:20 -04:00
parent 218f8f6589
commit 8b6bf53cca
2 changed files with 11 additions and 1 deletions

View File

@ -88,6 +88,10 @@ function bot:on_msg_receive(msg, config) -- The fn run whenever a message is rec
msg.text = msg.text or msg.caption or '' msg.text = msg.text or msg.caption or ''
msg.text_lower = msg.text:lower() msg.text_lower = msg.text:lower()
if msg.reply_to_message then
msg.reply_to_message.text = msg.reply_to_message.text or msg.reply_to_message.caption or ''
end
-- Support deep linking. -- Support deep linking.
if msg.text:match('^'..config.cmd_pat..'start .+') then if msg.text:match('^'..config.cmd_pat..'start .+') then
msg.text = config.cmd_pat .. utilities.input(msg.text) msg.text = config.cmd_pat .. utilities.input(msg.text)

View File

@ -4,6 +4,7 @@
local blacklist = {} local blacklist = {}
local utilities = require('otouto.utilities') local utilities = require('otouto.utilities')
local bindings = require('otouto.bindings')
function blacklist:init() function blacklist:init()
if not self.database.blacklist then if not self.database.blacklist then
@ -15,8 +16,13 @@ blacklist.triggers = {
'' ''
} }
blacklist.error = false
function blacklist:action(msg, config) function blacklist:action(msg, config)
if self.database.blacklist[tostring(msg.from.id)] or self.database.blacklist[tostring(msg.chat.id)] then if self.database.blacklist[tostring(msg.from.id)] then
return
elseif self.database.blacklist[tostring(msg.chat.id)] then
bindings.leaveChat(self, { chat_id = msg.chat.id })
return return
end end
if not ( if not (