administration.lua will unban /unban'd users in supergroups.

help.lua's help text is now alphabetized.
This commit is contained in:
topkecleon 2016-04-26 14:42:16 -04:00
parent 73f4863bc3
commit 86c290eb17
2 changed files with 37 additions and 8 deletions

View File

@ -615,9 +615,35 @@ local commands = {
end end
}, },
{ -- kickme
triggers = {
'^/leave$',
'^/leave@'..bot.username,
'^/kickme$',
'^/kickme@'..bot.username
},
command = 'kickme',
privilege = 1,
interior = true,
action = function(msg)
if get_rank(msg.from.id) == 5 then
sendReply(msg, 'I can\'t let you do that, '..msg.from.name..'.')
return
end
drua.kick_user(msg.chat.id, msg.from.id)
if msg.chat.type == 'supergroup' then
unbanChatMember(msg.chat.id, msg.from.id)
end
end
},
{ -- kick { -- kick
triggers = { triggers = {
'^/kick[@'..bot.username..']*' '^/kick$',
'^/kick ',
'^/kick@'..bot.username
}, },
command = 'kick <user>', command = 'kick <user>',
@ -663,6 +689,9 @@ local commands = {
end end
if group.bans[target.id_str] then if group.bans[target.id_str] then
group.bans[target.id_str] = nil group.bans[target.id_str] = nil
if msg.chat.type == 'supergroup' then
unbanChatMember(msg.chat.id, target.id)
end
sendReply(msg, target.name .. ' has been unbanned.') sendReply(msg, target.name .. ' has been unbanned.')
else else
group.bans[target.id_str] = true group.bans[target.id_str] = true

View File

@ -1,19 +1,19 @@
-- This plugin should go at the end of your plugin list in -- This plugin should go at the end of your plugin list in
-- config.lua, but not after greetings.lua. -- config.lua, but not after greetings.lua.
local help_text = '*Available commands:*' local commandlist = {}
for i,v in ipairs(plugins) do for i,v in ipairs(plugins) do
if v.command then if v.command then
help_text = help_text .. '\n• /' .. v.command:gsub('%[', '\\[') table.insert(commandlist, v.command)
end end
end end
help_text = help_text .. [[ table.insert(commandlist, 'help [command]')
table.sort(commandlist)
/help <command> local help_text = '*Available commands:*\n• /' .. table.concat(commandlist,'\n• /') .. '\nArguments: <required> [optional]'
Arguments: <required> \[optional]
]] help_text = help_text:gsub('%[', '\\[')
local triggers = { local triggers = {
'^/help[@'..bot.username..']*', '^/help[@'..bot.username..']*',