-
Notifications
You must be signed in to change notification settings - Fork 1
/
4_menu.lua
259 lines (251 loc) · 13.6 KB
/
4_menu.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
Menu = "ÒÅÕ.ÏÎÄÄÅÐÆÊÀ\\"
UserMenu = "ÞÇÅÐ\\"
AdminMenu = "ÍÀÑÒÐÎÉÊÀ\\"
ScriptEasy = false --Óïðîùåííîå ìåíþ óïðàâëåíèÿ ñêðèïòàìè (true - äà, false - íåò)
TempOP = true --Âêëþ÷åíèå ìåíþ "Âðåìåííûé îïåðàòîð" (true - äà, false - íåò)
RestartHub = true --Âêëþ÷åíèå ìåíþ "Ïåðåçàïóñê õàáà" (true - äà, false - íåò)
Prefix = "" --Ïðåôèêñ êîìàíä õàáà. Åñëè íå óêàçàí, èñïîëüçóåòñÿ ïåðâûé ïðåôèêñ èç íàñòðîåê õàáà.
sEnable = "+" -- Ñèìâîë ïåðåä ñêðèïòîì â ìåíþ, îáîçíà÷àþùèé ÷òî ñêðèïò âêëþ÷åí.
--###################################################################################
function OnStartup()
if Prefix == "" then
Prefix = SetMan.GetString(29):sub(1,1)
end
local tTmp = SetMan.GetHubBot()
bot = tTmp.sNick
end
function UserConnected(user)
local t = ProfMan.GetProfilePermissions(user.iProfile)
--Ãëîáàëüíûå êîìàíäû
Core.SendToUser(user,"$UserCommand 1 3 "..Menu.."Ïîìîùü$<%[mynick]> "..Prefix.."help|")
Core.SendToUser(user,"$UserCommand 1 3 "..Menu.."Ïîêàçàòü âàø IP àäðåñ$<%[mynick]> "..Prefix.."myip|")
if t then
--Ìåíþ þçåðà
if t.bGetInfo then
Core.SendToUser(user,"$UserCommand 1 2 "..UserMenu.."Ïîêàçàòü èíôîðìàöèþ$<%[mynick]> "..Prefix.."getinfo %[nick]|")
if t.bDrop or t.bKick or t.bTempBan or t.bBan or t.bAddRegUser or t.bDelRegUser or t.bMassMsg then
Core.SendToUser(user,"$UserCommand 0 2")
end
end
if t.bAddRegUser then
Core.SendToUser(user,"$UserCommand 1 2 "..UserMenu.."Ðåãèñòðàöèÿ\\Çàðåãèñòðèðîâàòü ïîëüçîâàòåëÿ$<%[mynick]> "..Prefix.."addreguser %[nick] %[line:Ïàðîëü] %[line:Èìÿ ïðîôèëÿ]|")
end
if t.bDelRegUser then
Core.SendToUser(user,"$UserCommand 1 2 "..UserMenu.."Ðåãèñòðàöèÿ\\Óäàëèòü ðåãèñòðàöèþ$<%[mynick]> "..Prefix.."delreguser %[nick]|")
end
if t.bMassMsg then
Core.SendToUser(user,"$UserCommand 1 2 "..UserMenu.."Ñîîáùåíèå îò èìåíè áîòà$<%[mynick]> "..Prefix.."frombot %[nick] %[line:Ââåäèòå òåêñò ñîîáùåíèÿ]|")
end
if t.bTempOP and TempOP then
Core.SendToUser(user,"$UserCommand 1 2 "..UserMenu.."Âðåìåííûé îïåðàòîð$<%[mynick]> "..Prefix.."op %[nick]|")
end
if (t.bAddRegUser or t.bDelRegUser or t.bMassMsg or (t.bTempOP and TempOP)) and (t.bDrop or t.bKick or t.bTempBan or t.bBan) then
Core.SendToUser(user,"$UserCommand 0 2")
end
if t.bDrop then
Core.SendToUser(user,"$UserCommand 1 2 "..UserMenu.."Îòêëþ÷èòü$<%[mynick]> "..Prefix.."disconnect %[nick]|")
end
if t.bKick then
Core.SendToUser(user,"$UserCommand 1 2 "..UserMenu.."Êèêíóòü$<%[mynick]> "..Prefix.."drop %[nick] %[line:Ïðè÷èíà]|")
end
if t.bTempBan then
Core.SendToUser(user,"$UserCommand 1 2 "..UserMenu.."Áàí 1 ÷àñ$<%[mynick]> "..Prefix.."nicktempban %[nick] 1h %[line:Ïðè÷èíà]|")
Core.SendToUser(user,"$UserCommand 1 2 "..UserMenu.."Áàí 24 ÷àñà$<%[mynick]> "..Prefix.."nicktempban %[nick] 1d %[line:Ïðè÷èíà]|")
Core.SendToUser(user,"$UserCommand 1 2 "..UserMenu.."Âðåìåííûé áàí...$<%[mynick]> "..Prefix.."nicktempban %[nick] %[line:Âðåìÿ (m = ìèíóò, h = ÷àñîâ, d = äíåé, w = íåäåëü)] %[line:Ïðè÷èíà]|")
end
if t.bBan then
Core.SendToUser(user,"$UserCommand 1 2 "..UserMenu.."Ïîñòîÿííûé áàí$<%[mynick]> "..Prefix.."nickban %[nick] %[line:Ïðè÷èíà]|")
end
--Óïðàâëåíèå õàáîì
if t.bTopic then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Òîïèê\\Óñòàíîâèòü òîïèê$<%[mynick]> "..Prefix.."topic %[line:Ââåäèòå òåêñò]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Òîïèê\\Î÷èñòèòü òîïèê$<%[mynick]> "..Prefix.."topic off|")
end
if t.bRefreshTxt then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Òåêñòîâûå ôàéëû\\Ïåðåçàï. òåêñò. ôàéëû$<%[mynick]> "..Prefix.."reloadtxt|")
end
if t.bMassMsg then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ðàññûëêà ñîîáùåíèé\\Ìàññîâàÿ ðàññûëêà$<%[mynick]> "..Prefix.."massmsg %[line:Ââåäèòå òåêñò ñîîáùåíèÿ]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ðàññûëêà ñîîáùåíèé\\Ðàññûëêà ÎÏàì$<%[mynick]> "..Prefix.."opmassmsg %[line:Ââåäèòå òåêñò ñîîáùåíèÿ]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñîîáùåíèå îò èìåíè áîòà$<%[mynick]> "..Prefix.."frombot %[line:Íèê] %[line:Ââåäèòå òåêñò ñîîáùåíèÿ]|")
end
--Ñïèñêè áàíîâ
if t.bGetBans then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû\\Ñïèñîê áàíîâ$<%[mynick]> "..Prefix.."getbans|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû\\Ñïèñîê âðåìåííûõ áàíîâ$<%[mynick]> "..Prefix.."gettempbans|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû\\Ñïèñîê ïîñòîÿííûõ áàíîâ$<%[mynick]> "..Prefix.."getpermbans|")
Core.SendToUser(user,"$UserCommand 0 3")
end
--Âðåìåííûå áàíû
if t.bTempBan then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû\\Âðåìåííûé áàí$<%[mynick]> "..Prefix.."nicktempban %[line:Íèê] %[line:Âðåìÿ (m = ìèíóò, h = ÷àñîâ, d = äíåé, w = íåäåëü)] %[line:Ïðè÷èíà]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû\\Âðåìåííûé áàí IP$<%[mynick]> "..Prefix.."tempbanip %[line:Óêàæèòå IP] %[line:Âðåìÿ (m = ìèíóò, h = ÷àñîâ, d = äíåé, w = íåäåëü)] %[line:Ïðè÷èíà]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû\\Âðåìåííûé áàí IP (ïîëíûé)$<%[mynick]> "..Prefix.."fulltempbanip %[line:Óêàæèòå IP] %[line:Âðåìÿ (m = ìèíóò, h = ÷àñîâ, d = äíåé, w = íåäåëü)] %[line:Ïðè÷èíà]|")
Core.SendToUser(user,"$UserCommand 0 3")
end
if t.bTempUnban then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû\\Ñíÿòü âðåìåííûé áàí$<%[mynick]> "..Prefix.."tempunban %[line:IP èëè íèê]|")
Core.SendToUser(user,"$UserCommand 0 3")
end
--Ïîñòîÿííûå áàíû
if t.bBan then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû\\Áàí$<%[mynick]> "..Prefix.."nickban %[line:Íèê] %[line:Ïðè÷èíà]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû\\Áàí IP$<%[mynick]> "..Prefix.."banip %[line:Óêàæèòå IP] %[line:Ïðè÷èíà]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû\\Áàí IP (ïîëíûé)$<%[mynick]> "..Prefix.."fullbanip %[line:Óêàæèòå IP] %[line:Ïðè÷èíà]|")
Core.SendToUser(user,"$UserCommand 0 3")
end
if t.bUnban then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû\\Ñíÿòü áàí$<%[mynick]> "..Prefix.."unban %[line:Íèê èëè IP]|")
Core.SendToUser(user,"$UserCommand 0 3")
end
--Ñïèñêè äèàïàçîíîâ áàíîâ
if t.bGetRangeBans then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû äèàïàçîíîâ\\Ñïèñîê äèàïàçîíîâ áàíîâ $<%[mynick]> "..Prefix.."getrangebans|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû äèàïàçîíîâ\\Ñïèñîê âðåìåííûõ áàíîâ äèàïàçîíîâ$<%[mynick]> "..Prefix.."getrangetempbans|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû äèàïàçîíîâ\\Ñïèñîê ïîñòîÿííûõ áàíîâ äèàïàçîíîâ$<%[mynick]> "..Prefix.."getrangepermbans|")
Core.SendToUser(user,"$UserCommand 0 3")
end
--Âðåìåííûå áàíû äèàïàçîíîâ
if t.bRangeTempBan then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû äèàïàçîíîâ\\Âðåìåííûé áàí äèàïàçîíà$<%[mynick]> "..Prefix.."rangetempban %[line:Íà÷àëüíûé IP äèàïàçîíà] %[line:Êîíå÷íûé IP äèàïàçîíà] %[line:Âðåìÿ (m = ìèíóò, h = ÷àñîâ, d = äíåé, w = íåäåëü)] %[line:Ïðè÷èíà]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû äèàïàçîíîâ\\Âðåìåííûé áàí äèàïàçîíà (ïîëíûé)$<%[mynick]> "..Prefix.."fullrangetempban %[line:Íà÷àëüíûé IP äèàïàçîíà] %[line:Êîíå÷íûé IP äèàïàçîíà] %[line:Âðåìÿ (m = ìèíóò, h = ÷àñîâ, d = äíåé, w = íåäåëü)] %[line:Ïðè÷èíà]|")
Core.SendToUser(user,"$UserCommand 0 3")
end
if t.bRangeTempUnban then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû äèàïàçîíîâ\\Ñíÿòü âðåìåííûé áàí äèàïàçîíà$<%[mynick]> "..Prefix.."tempunban %[line:Íà÷àëüíûé IP äèàïàçîíà] %[line:Êîíå÷íûé IP äèàïàçîíà]|")
Core.SendToUser(user,"$UserCommand 0 3")
end
--Ïîñòîÿííûå áàíû äèàïàçîíîâ
if t.bRangeBan then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû äèàïàçîíîâ\\Áàí äèàïàçîíà$<%[mynick]> "..Prefix.."rangeban %[line:Íà÷àëüíûé IP äèàïàçîíà] %[line:Êîíå÷íûé IP äèàïàçîíà] %[line:Ïðè÷èíà]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû äèàïàçîíîâ\\Áàí äèàïàçîíà (ïîëíûé)$<%[mynick]> "..Prefix.."fullrangeban %[line:Íà÷àëüíûé IP äèàïàçîíà] %[line:Êîíå÷íûé IP äèàïàçîíà] %[line:Ïðè÷èíà]|")
Core.SendToUser(user,"$UserCommand 0 3")
end
if t.bRangeUnban then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Áàíû äèàïàçîíîâ\\Ñíÿòü áàí äèàïàçîíà$<%[mynick]> "..Prefix.."rangepermunban %[line:Íà÷àëüíûé IP äèàïàçîíà] %[line:Êîíå÷íûé IP äèàïàçîíà]|")
Core.SendToUser(user,"$UserCommand 0 3")
end
--Ðåãèñòðàöèÿ
if t.bAddRegUser then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ðåãèñòðàöèÿ\\Çàðåãèñòðèðîâàòü ïîëüçîâàòåëÿ$<%[mynick]> "..Prefix.."addreguser %[line:Íèê] %[line:Ïàðîëü] %[line:Èìÿ ïðîôèëÿ]|")
end
if t.bDelRegUser then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ðåãèñòðàöèÿ\\Óäàëèòü ðåãèñòðàöèþ$<%[mynick]> "..Prefix.."delreguser %[line:Íèê]|")
end
--Óïðàâëåíèå ñêðèïòàìè
if t.bRestartScripts then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñêðèïòû\\Ïîñìîòðåòü ñïèñîê$<%[mynick]> "..Prefix.."getscripts|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñêðèïòû\\Ïåðåçàïóñòèòü ñêðèïòû$<%[mynick]> "..Prefix.."restartscripts|")
Core.SendToUser(user,"$UserCommand 0 3")
if ScriptEasy then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñêðèïòû\\Ïåðåçàïóñê$<%[mynick]> "..Prefix.."restartscript %[line:Èìÿ ôàéëà]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñêðèïòû\\Ñòàðò$<%[mynick]> "..Prefix.."startscript %[line:Èìÿ ôàéëà]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñêðèïòû\\Ñòîï$<%[mynick]> "..Prefix.."stopscript %[line:Èìÿ ôàéëà]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñêðèïòû\\Ñäâèíóòü ââåðõ$<%[mynick]> "..Prefix.."scriptmoveup %[line:Èìÿ ôàéëà]|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñêðèïòû\\Ñäâèíóòü âíèç$<%[mynick]> "..Prefix.."scriptmovedown %[line:Èìÿ ôàéëà]|")
else
local sEn = sEnable.." "
local tScripts = ScriptMan.GetScripts()
for script in pairs(tScripts) do
local CurScript = tScripts[script].sName
local bEnabled = tScripts[script].bEnabled or false
if bEnabled then Scr = sEn..CurScript else Scr = " "..CurScript end
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñêðèïòû\\"..Scr.."\\Ïåðåçàïóñê$<%[mynick]> "..Prefix.."restartscript "..CurScript.."|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñêðèïòû\\"..Scr.."\\Ñòàðò$<%[mynick]> "..Prefix.."startscript "..CurScript.."|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñêðèïòû\\"..Scr.."\\Ñòîï$<%[mynick]> "..Prefix.."stopscript "..CurScript.."|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñêðèïòû\\"..Scr.."\\Ñäâèíóòü ââåðõ$<%[mynick]> "..Prefix.."scriptmoveup "..CurScript.."|")
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñêðèïòû\\"..Scr.."\\Ñäâèíóòü âíèç$<%[mynick]> "..Prefix.."scriptmovedown "..CurScript.."|")
end
end
end
--Ñòàòèñòèêà
if t.bIsOP then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ñòàòèñòèêà$<%[mynick]> "..Prefix.."stats|")
end
if t.bRestartHub and RestartHub then
Core.SendToUser(user,"$UserCommand 1 3 "..AdminMenu.."Ïåðåçàïóñê õàáà$<%[mynick]> "..Prefix.."restart|")
end
end
end
OpConnected = UserConnected
RegConnected = UserConnected
function ChatArrival(user,data)
data = data:sub(1,-2)
local t = ProfMan.GetProfilePermissions(user.iProfile)
local pre,cmd = data:match("^%b<>%s+(%p)(%S+)")
local param = data:match("^%b<>%s+%p%S+%s+(.+)")
if pre == Prefix then
if t then
if t.bRestartScripts then
if cmd and cmd == "scriptmoveup" then
if param then
result = ScriptMan.MoveUp(param)
if result then
ToOps(user.sNick..": Ñêðèïò "..param.." ïåðåìåù¸í ââåðõ íà îäíó ïîçèöèþ.")
else
ToUser(user,"Îøèáêà: ñêðèïò "..param.." ïåðåìåñòèòü íå óäàëîñü.")
end
else
ToUser(user,"<"..bot.."> Îøèáêà. Âû äîëæíû óêàçàòü èìÿ ôàéëà.")
end
return true
elseif cmd and cmd == "scriptmovedown" then
if param then
result = ScriptMan.MoveDown(param)
if result then
ToOps(user.sNick..": Ñêðèïò "..param.." ïåðåìåù¸í âíèç íà îäíó ïîçèöèþ.")
else
ToUser(user,"Îøèáêà: ñêðèïò "..param.." ïåðåìåñòèòü íå óäàëîñü.")
end
else
ToUser(user,"<"..bot.."> Îøèáêà. Âû äîëæíû óêàçàòü èìÿ ôàéëà.")
end
return true
end
end
if t.bDrop then
if cmd and cmd == "disconnect" then
if param then
local CurUser = Core.GetUser(param)
if CurUser then
Core.Disconnect(CurUser)
ToOps(user.sNick.." îòêëþ÷èë þçåðà "..param)
else
ToUser(user,"Îøèáêà: þçåð "..param.." íå íàéäåí íà õàáå")
end
else
ToUser(user,"Îøèáêà: Âû äîëæíû óêàçàòü íèê.")
end
return true
end
end
if t.bMassMsg then
if cmd and cmd == "frombot" then
local s,e,nick,msg = string.find(param, "^(%S+)%s+(.+)$")
if nick and msg then
local CurUser = Core.GetUser(nick)
if CurUser then
FromBot(CurUser,msg)
ToUser(user,"Ñîîáùåíèå îòïðàâëåíî")
ToOps(user.sNick.." îòïðàâèë ñîîáùåíèå îò èìåíè áîòà þçåðó "..nick.." :"..msg)
else
ToUser(user,"Îøèáêà: þçåð "..nick.." íå íàéäåí íà õàáå")
end
else
ToUser(user,"Îøèáêà ñèíòàêñèñà. Ñèíòàêñèñ: "..Prefix.."frombot <íèê> <òåêñò ñîîáùåíèÿ>")
end
return true
end
end
end
end
end
function ToUser(user,msg)
Core.SendToUser(user,"<"..bot.."> "..msg)
end
function ToOps(msg)
Core.SendToOps("<"..bot.."> "..msg)
end
function FromBot(user,msg)
Core.SendPmToUser(user,bot,msg)
end