diff --git a/plugins/administration.lua b/plugins/administration.lua index eb1e0e1..53b0c31 100644 --- a/plugins/administration.lua +++ b/plugins/administration.lua @@ -615,9 +615,35 @@ local commands = { 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 triggers = { - '^/kick[@'..bot.username..']*' + '^/kick$', + '^/kick ', + '^/kick@'..bot.username }, command = 'kick ', @@ -663,6 +689,9 @@ local commands = { end if group.bans[target.id_str] then 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.') else group.bans[target.id_str] = true diff --git a/plugins/help.lua b/plugins/help.lua index c0589dd..f0a9e5d 100755 --- a/plugins/help.lua +++ b/plugins/help.lua @@ -1,19 +1,19 @@ -- This plugin should go at the end of your plugin list in -- config.lua, but not after greetings.lua. -local help_text = '*Available commands:*' - +local commandlist = {} for i,v in ipairs(plugins) do if v.command then - help_text = help_text .. '\n• /' .. v.command:gsub('%[', '\\[') + table.insert(commandlist, v.command) end end -help_text = help_text .. [[ +table.insert(commandlist, 'help [command]') +table.sort(commandlist) -• /help -Arguments: \[optional] -]] +local help_text = '*Available commands:*\n• /' .. table.concat(commandlist,'\n• /') .. '\nArguments: [optional]' + +help_text = help_text:gsub('%[', '\\[') local triggers = { '^/help[@'..bot.username..']*',