acc7046d64
Added optional target for kick/ban logs. Added flag 7 to use default log per group. This way, a realm can have a public kick/ban log but governors are able to opt out. Added flag 8, antilink. Kicks for Telegram join links which do not refer to groups within the realm. Added flag 9, modrights, to give moderators access to changing the group photo, title, link, and motd (config option is deprecated. RIP). /unban will reset the target's autokick counter. Added configuration for default flag settings. Revision to bindings.lua. BASE_URL has been moved to bindings. There is no real reason for it to remain in instance. Token is passed to bindings.init at load. All plugins have been updated accordingly.
40 lines
1.7 KiB
Lua
40 lines
1.7 KiB
Lua
local reactions = {}
|
|
|
|
local utilities = require('otouto.utilities')
|
|
|
|
reactions.command = 'reactions'
|
|
reactions.doc = 'Returns a list of "reaction" emoticon commands.'
|
|
|
|
function reactions:init(config)
|
|
-- Generate a command list message triggered by "/reactions".
|
|
reactions.help = 'Reactions:\n'
|
|
reactions.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('reactions').table
|
|
local username = self.info.username:lower()
|
|
for trigger, reaction in pairs(config.reactions) do
|
|
reactions.help = reactions.help .. '• ' .. config.cmd_pat .. trigger .. ': ' .. reaction .. '\n'
|
|
table.insert(reactions.triggers, '^'..config.cmd_pat..trigger)
|
|
table.insert(reactions.triggers, '^'..config.cmd_pat..trigger..'@'..username)
|
|
table.insert(reactions.triggers, config.cmd_pat..trigger..'$')
|
|
table.insert(reactions.triggers, config.cmd_pat..trigger..'@'..username..'$')
|
|
table.insert(reactions.triggers, '\n'..config.cmd_pat..trigger)
|
|
table.insert(reactions.triggers, '\n'..config.cmd_pat..trigger..'@'..username)
|
|
table.insert(reactions.triggers, config.cmd_pat..trigger..'\n')
|
|
table.insert(reactions.triggers, config.cmd_pat..trigger..'@'..username..'\n')
|
|
end
|
|
end
|
|
|
|
function reactions:action(msg, config)
|
|
if string.match(msg.text_lower, config.cmd_pat..'reactions') then
|
|
utilities.send_message(msg.chat.id, reactions.help, true, nil, 'html')
|
|
return
|
|
end
|
|
for trigger,reaction in pairs(config.reactions) do
|
|
if string.match(msg.text_lower, config.cmd_pat..trigger) then
|
|
utilities.send_message(msg.chat.id, reaction, true, nil, 'html')
|
|
return
|
|
end
|
|
end
|
|
end
|
|
|
|
return reactions
|