forked from infernal1200/Virus-Tg
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetwlc.lua
55 lines (42 loc) · 1.54 KB
/
setwlc.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
local function run(msg, matches, callback, extra)
local data = load_data(_config.moderation.data)
local group_welcome = data[tostring(msg.to.id)]['group_welcome']
-------------------------- Data Will be save on Moderetion.json
if matches[1] == 'delwlc' and not matches[2] and is_owner(msg) then
data[tostring(msg.to.id)]['group_welcome'] = nil --delete welcome
save_data(_config.moderation.data, data)
return 'Group welcome Deleted!'
end
if not is_owner(msg) then
return 'For Owners Only!'
end
--------------------Loading Group Rules
local rules = data[tostring(msg.to.id)]['rules']
if matches[1] == 'rules' and matches[2] and is_owner(msg) then
if data[tostring(msg.to.id)]['rules'] == nil then --when no rules found....
return 'No Rules Found!\n\nSet Rule first by /set rules [rules]\nOr\nset normal welcome by /setwlc [wlc msg]'
end
data[tostring(msg.to.id)]['group_welcome'] = matches[2]..'\n\nGroup Rules :\n'..rules
save_data(_config.moderation.data, data)
return 'Group welcome Seted To :\n'..matches[2]
end
if not is_owner(msg) then
return 'For Owners Only!'
end
if matches[1] and is_owner(msg) then
data[tostring(msg.to.id)]['group_welcome'] = matches[1]
save_data(_config.moderation.data, data)
return 'Group welcome Seted To : \n'..matches[1]
end
if not is_owner(msg) then
return 'For Owners Only!'
end
end
return {
patterns = {
"^[!/]setwlc (rules) +(.*)$",
"^[!/]setwlc +(.*)$",
"^[!/](delwlc)$"
},
run = run
}