|
|
|
@ -39,6 +39,9 @@
|
|
|
|
|
"/gadd 1 4 5" will add a grouo with the unlisted, antibot, and antiflood
|
|
|
|
|
flags.
|
|
|
|
|
|
|
|
|
|
1.10.4 - Kick notifications now include user IDs. Errors are silenced.
|
|
|
|
|
/flags can now be used with multiple arguments, similar to /gadd.
|
|
|
|
|
|
|
|
|
|
]]--
|
|
|
|
|
|
|
|
|
|
local JSON = require('dkjson')
|
|
|
|
@ -125,15 +128,15 @@ function administration.init_flags(cmd_pat) return {
|
|
|
|
|
} end
|
|
|
|
|
|
|
|
|
|
administration.antiflood = {
|
|
|
|
|
text = 10,
|
|
|
|
|
voice = 10,
|
|
|
|
|
audio = 10,
|
|
|
|
|
contact = 10,
|
|
|
|
|
photo = 20,
|
|
|
|
|
video = 20,
|
|
|
|
|
location = 20,
|
|
|
|
|
document = 20,
|
|
|
|
|
sticker = 30
|
|
|
|
|
text = 5,
|
|
|
|
|
voice = 5,
|
|
|
|
|
audio = 5,
|
|
|
|
|
contact = 5,
|
|
|
|
|
photo = 10,
|
|
|
|
|
video = 10,
|
|
|
|
|
location = 10,
|
|
|
|
|
document = 10,
|
|
|
|
|
sticker = 20
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
administration.ranks = {
|
|
|
|
@ -767,6 +770,38 @@ function administration.init_command(self_, config)
|
|
|
|
|
end
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ -- /setmotd
|
|
|
|
|
triggers = utilities.triggers(self_.info.username, config.cmd_pat):t('setmotd', true).table,
|
|
|
|
|
|
|
|
|
|
command = 'setmotd <motd>',
|
|
|
|
|
privilege = 2,
|
|
|
|
|
interior = true,
|
|
|
|
|
doc = 'Sets the group\'s message of the day. Markdown is supported. Pass "--" to delete the message.',
|
|
|
|
|
|
|
|
|
|
action = function(self, msg, group, config)
|
|
|
|
|
local input = utilities.input(msg.text)
|
|
|
|
|
if not input and msg.reply_to_message and msg.reply_to_message.text:len() > 0 then
|
|
|
|
|
input = msg.reply_to_message.text
|
|
|
|
|
end
|
|
|
|
|
if input then
|
|
|
|
|
if input == '--' or input == utilities.char.em_dash then
|
|
|
|
|
group.motd = nil
|
|
|
|
|
utilities.send_reply(self, msg, 'The MOTD has been cleared.')
|
|
|
|
|
else
|
|
|
|
|
input = utilities.trim(input)
|
|
|
|
|
group.motd = input
|
|
|
|
|
local output = '*MOTD for ' .. msg.chat.title .. ':*\n' .. input
|
|
|
|
|
utilities.send_message(self, msg.chat.id, output, true, nil, true)
|
|
|
|
|
end
|
|
|
|
|
if group.grouptype == 'supergroup' then
|
|
|
|
|
administration.update_desc(self, msg.chat.id, config)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
utilities.send_reply(self, msg, 'Please specify the new message of the day.')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ -- /setrules
|
|
|
|
|
triggers = utilities.triggers(self_.info.username, config.cmd_pat):t('setrules', true).table,
|
|
|
|
|
|
|
|
|
@ -834,38 +869,6 @@ function administration.init_command(self_, config)
|
|
|
|
|
end
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ -- /setmotd
|
|
|
|
|
triggers = utilities.triggers(self_.info.username, config.cmd_pat):t('setmotd', true).table,
|
|
|
|
|
|
|
|
|
|
command = 'setmotd <motd>',
|
|
|
|
|
privilege = 2,
|
|
|
|
|
interior = true,
|
|
|
|
|
doc = 'Sets the group\'s message of the day. Markdown is supported. Pass "--" to delete the message.',
|
|
|
|
|
|
|
|
|
|
action = function(self, msg, group, config)
|
|
|
|
|
local input = utilities.input(msg.text)
|
|
|
|
|
if not input and msg.reply_to_message and msg.reply_to_message.text:len() > 0 then
|
|
|
|
|
input = msg.reply_to_message.text
|
|
|
|
|
end
|
|
|
|
|
if input then
|
|
|
|
|
if input == '--' or input == utilities.char.em_dash then
|
|
|
|
|
group.motd = nil
|
|
|
|
|
utilities.send_reply(self, msg, 'The MOTD has been cleared.')
|
|
|
|
|
else
|
|
|
|
|
input = utilities.trim(input)
|
|
|
|
|
group.motd = input
|
|
|
|
|
local output = '*MOTD for ' .. msg.chat.title .. ':*\n' .. input
|
|
|
|
|
utilities.send_message(self, msg.chat.id, output, true, nil, true)
|
|
|
|
|
end
|
|
|
|
|
if group.grouptype == 'supergroup' then
|
|
|
|
|
administration.update_desc(self, msg.chat.id, config)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
utilities.send_reply(self, msg, 'Please specify the new message of the day.')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ -- /setlink
|
|
|
|
|
triggers = utilities.triggers(self_.info.username, config.cmd_pat):t('setlink', true).table,
|
|
|
|
|
|
|
|
|
@ -910,34 +913,40 @@ function administration.init_command(self_, config)
|
|
|
|
|
{ -- /flags
|
|
|
|
|
triggers = utilities.triggers(self_.info.username, config.cmd_pat):t('flags?', true).table,
|
|
|
|
|
|
|
|
|
|
command = 'flag \\[i]',
|
|
|
|
|
command = 'flag \\[i] ...',
|
|
|
|
|
privilege = 3,
|
|
|
|
|
interior = true,
|
|
|
|
|
doc = 'Returns a list of flags or toggles the specified flag.',
|
|
|
|
|
doc = 'Returns a list of flags or toggles the specified flags.',
|
|
|
|
|
|
|
|
|
|
action = function(self, msg, group, config)
|
|
|
|
|
local output = ''
|
|
|
|
|
local input = utilities.input(msg.text)
|
|
|
|
|
if input then
|
|
|
|
|
input = utilities.get_word(input, 1)
|
|
|
|
|
input = tonumber(input)
|
|
|
|
|
if not input or not administration.flags[input] then
|
|
|
|
|
local index = utilities.index(input)
|
|
|
|
|
for _, i in ipairs(index) do
|
|
|
|
|
n = tonumber(i)
|
|
|
|
|
if n and administration.flags[n] then
|
|
|
|
|
if group.flags[n] == true then
|
|
|
|
|
group.flags[n] = false
|
|
|
|
|
output = output .. administration.flags[n].disabled .. '\n'
|
|
|
|
|
else
|
|
|
|
|
group.flags[n] = true
|
|
|
|
|
output = output .. administration.flags[n].enabled .. '\n'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if output == '' then
|
|
|
|
|
input = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if not input then
|
|
|
|
|
local output = '*Flags for ' .. msg.chat.title .. ':*\n'
|
|
|
|
|
for i,v in ipairs(administration.flags) do
|
|
|
|
|
output = '*Flags for ' .. msg.chat.title .. ':*\n'
|
|
|
|
|
for i, flag in ipairs(administration.flags) do
|
|
|
|
|
local status = group.flags[i] or false
|
|
|
|
|
output = output .. '`[' .. i .. ']` *' .. v.name .. '*` = ' .. tostring(status) .. '`\n• ' .. v.desc .. '\n'
|
|
|
|
|
output = output .. '*' .. i .. '. ' .. flag.name .. '* `[' .. tostring(status) .. ']`\n• ' .. flag.desc .. '\n'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
utilities.send_message(self, msg.chat.id, output, true, nil, true)
|
|
|
|
|
elseif group.flags[input] == true then
|
|
|
|
|
group.flags[input] = false
|
|
|
|
|
utilities.send_reply(self, msg, administration.flags[input].disabled)
|
|
|
|
|
else
|
|
|
|
|
group.flags[input] = true
|
|
|
|
|
utilities.send_reply(self, msg, administration.flags[input].enabled)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -1208,10 +1217,10 @@ function administration.init_command(self_, config)
|
|
|
|
|
{ -- /gadd
|
|
|
|
|
triggers = utilities.triggers(self_.info.username, config.cmd_pat):t('gadd', true).table,
|
|
|
|
|
|
|
|
|
|
command = 'gadd [i] ...',
|
|
|
|
|
command = 'gadd \\[i] ...',
|
|
|
|
|
privilege = 5,
|
|
|
|
|
interior = false,
|
|
|
|
|
doc = 'Adds a group to the administration system. Pass numbers as arguments to enable those flags immediately. For example, this would add the group and enable the unlisted flag, antibot, and antiflood:\n/gadd 1 4 5',
|
|
|
|
|
doc = 'Adds a group to the administration system. Pass numbers as arguments to enable those flags immediately.\nExample usage:\n\t/gadd 1 4 5\nThis would add a group and enable the unlisted flag, antibot, and antiflood.',
|
|
|
|
|
|
|
|
|
|
action = function(self, msg, group, config)
|
|
|
|
|
if msg.chat.id == msg.from.id then
|
|
|
|
@ -1219,6 +1228,7 @@ function administration.init_command(self_, config)
|
|
|
|
|
elseif self.database.administration.groups[msg.chat.id_str] then
|
|
|
|
|
utilities.send_reply(self, msg, 'I am already administrating this group.')
|
|
|
|
|
else
|
|
|
|
|
local output = 'I am now administrating this group.'
|
|
|
|
|
local flags = {}
|
|
|
|
|
for i = 1, #administration.flags do
|
|
|
|
|
flags[i] = false
|
|
|
|
@ -1227,9 +1237,10 @@ function administration.init_command(self_, config)
|
|
|
|
|
if input then
|
|
|
|
|
local index = utilities.index(input)
|
|
|
|
|
for _, i in ipairs(index) do
|
|
|
|
|
i = tonumber(i)
|
|
|
|
|
if i and i < #administration.flags and i > 0 then
|
|
|
|
|
flags[i] = true
|
|
|
|
|
n = tonumber(i)
|
|
|
|
|
if n and administration.flags[n] and flags[n] ~= true then
|
|
|
|
|
flags[n] = true
|
|
|
|
|
output = output .. '\n' .. administration.flags[n].short
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -1249,7 +1260,7 @@ function administration.init_command(self_, config)
|
|
|
|
|
}
|
|
|
|
|
administration.update_desc(self, msg.chat.id, config)
|
|
|
|
|
table.insert(self.database.administration.activity, msg.chat.id_str)
|
|
|
|
|
utilities.send_reply(self, msg, 'I am now administrating this group.')
|
|
|
|
|
utilities.send_reply(self, msg, output)
|
|
|
|
|
drua.channel_set_admin(msg.chat.id, self.info.id, 2)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -1334,18 +1345,6 @@ function administration.init_command(self_, config)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ -- /buildwall :^)
|
|
|
|
|
triggers = utilities.triggers(self_.info.username, config.cmd_pat):t('buildwall').table,
|
|
|
|
|
privilege = 3,
|
|
|
|
|
interior = true,
|
|
|
|
|
action = function(self, msg, group, config)
|
|
|
|
|
for i = 2, 5 do
|
|
|
|
|
group.flags[i] = true
|
|
|
|
|
end
|
|
|
|
|
utilities.send_message(self, msg.chat.id, 'antisquig, antisquig++, antibot, and antiflood have been enabled.')
|
|
|
|
|
end
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|