Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --plugin made by @haam00dy and @thisisarman
- do
- local function create_group_fromvip(msg)
- -- superuser and vip only (because sudo are always has privilege
- if is_vgroup(msg) then
- local group_creator = msg.from.print_name
- create_group_chat (group_creator, group_name, ok_cb, false)
- return 'Group [ '..string.gsub(group_name, '_', ' ')..' ] has been created.'
- end
- end
- local function vip_list(msg)
- local data = load_data(_config.moderation.data)
- local admins = 'vip'
- if not data[tostring(admins)] then
- data[tostring(admins)] = {}
- save_data(_config.moderation.data, data)
- end
- local message = "List for bot's VIP:\n"
- for k,v in pairs(data[tostring(admins)]) do
- message = message .. '- @' .. v .. ' [' .. k .. '] ' ..'\n'
- end
- return message
- end
- local function vip_help()
- local help_text = tostring(_config.vip_help)
- return help_text
- end
- local function action_by_reply(extra, success, result)
- local msg = result
- local chat = msg.to.id
- local user_id = msg.from.id
- local receiver = extra.receiver
- local create_hash = 'creator:'..msg.from.id
- if msg.to.type == 'chat' then
- if extra.match == 'charge' then
- redis:set(create_hash, 0)
- send_large_msg(receiver, 'charged!!!')
- end
- else
- return 'In groups only'
- end
- end
- local function run(msg, matches)
- local user_id = msg.from.id
- local create_hash = 'creator:'..user_id
- local is_create_offender = redis:get(create_hash)
- if msg.to.type == 'chat' and is_vgroup(msg) then
- if is_vip(msg) then
- if matches[1] == 'list' and matches[2] == 'vips' then
- return vip_list(msg)
- end
- if matches[1] == 'chat_add_user' then--if user added to vip group
- if not msg.service then
- return "Are you trying to troll me?"
- end
- local user = 'user#id'..msg.action.user.id
- local chat = 'chat#id'..msg.to.id
- if not is_vip(msg) then
- chat_del_user(chat, user, ok_cb, true)
- end
- end
- if matches[1] == 'help' and is_vgroup(msg) then
- return vip_help()
- end
- if matches[1] == 'creategroup' and matches[2] then
- redis:incr(create_hash)
- if is_create_offender then
- if tonumber(create_hash) == 2 then
- send_large_msg('chat#id'..msg.to.id, 'Group creation limit reached pls contact sudo for more credit')
- end
- redis:incr(create_hash)
- group_name = matches[2]
- group_type = 'group'
- return create_group_fromvip(msg)
- end
- end
- if matches[1] == 'charge' then
- if type(msg.reply_id) ~= 'nil' then
- msgr = get_message(msg.reply_id, action_by_reply, {match=matches[1],receiver=get_receiver(msg)})
- end
- end
- end
- end
- end
- return {
- patterns = {
- "^[!/#]vip ([Cc]reategroup) (.*)$",
- "^[!/#]([Ll]ist) (vips)$",
- "^[!/#]([Hh]elp)$",
- "^[!/#]([Cc]harge)$",
- "^!!tgservice (.+)$",
- },
- run = run
- }
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement