-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCall.lua
More file actions
263 lines (226 loc) · 7.39 KB
/
Call.lua
File metadata and controls
263 lines (226 loc) · 7.39 KB
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
260
261
262
263
--!nonstrict
--[[
Author: EasternBloxxer, TheDiamondWolf1960
Description: Adonis ModCall plugin
You can expect a lot of old and bad code here. A lot of the code is from a very long time ago
I have rewritten some of it but a lot of things here could still be done better.
Usage:
Place this in a ModuleScript under Adonis_Loader > Config > Plugins and named "Server-Call"
or leave it as Call when putting it in MainModule -> Server -> Plugins
Put the CallMenuTheme.rbxmx located in the same repo in Loader -> Config -> Themes
--]]
server = nil
service = nil
Routine = nil
reportedplr = nil
cooldowndata = {}
return function()
local Admin = server.Admin;
local Settings = server.Settings;
local Functions = server.Functions;
local Remote = server.Remote;
local Variables = server.Variables;
local HTTP = server.HTTP;
local Anti = server.Anti;
local PluginSettings = {
CallCooldown = 60 :: number,
Reasons = {"Exploiting","Spamming","Chat bypassing","Inappropriate behavior","Misc"},
TextContent = ""; -- Whatever you want the non-embed text to be. This can be like a mod role or whatever. Just be sure the moderators can opt out of receiving these (i am Not evil.)
BaseURL = "https://webhook.lewisakura.moe", -- This will be whatever proxy you use without / obviously
Webhook = "/api/webhooks/CHANNEL/TOKEN", -- Webhook goes here
APIKey = "" :: string,
--// This can be left blank unless
--// You are using a custom backend
--// That requires api key
}
local TextService = service.TextService
local MarketplaceService = service.MarketplaceService
local PrivateServerId = game.PrivateServerId
local PrivateServerOwnerId = game.PrivateServerOwnerId
local Asset = { Name = "Failed to fetch Place Info" }
local placeId = game.PlaceId
local getServerType = function()
if game:GetService("RunService"):IsStudio() then
return "Studio"
else
if PrivateServerId ~= "" then
if PrivateServerOwnerId ~= 0 then
return "Private"
else
return "Reserved"
end
else
return "Standard"
end
end
end;
pcall(function()
Asset = MarketplaceService:GetProductInfo(game.PlaceId)
end)
server.Commands.Call = {
Prefix = Settings.PlayerPrefix,
Commands = { "call", "report" },
Args = {},
Fun = false,
Hidden = false,
Description = "Report a player to moderators",
AdminLevel = "Players",
Function = function(plr, args)
if cooldowndata[plr.UserId] then
return Remote.MakeGui(plr, "Hint", { Message = "Your call cooldown has not ended!" })
end
local Name = plr.Name
local extras = { "Server" }
for i, v in service.GetPlayers() do
local level = Admin.GetLevel(v)
local name = v.Name
if level < 100 and name == Name then
table.insert(extras, name)
end
end
Remote.MakeGui(plr, "CallMenu", { Reasons = PluginSettings.Reasons, Players = extras }, {Desktop = "Astra"; Mobile = "Astra"})
end,
};
server.Commands.ClearCallCooldown = {
Prefix = Settings.Prefix,
Commands = { "ClearCooldown" },
Args = {},
Fun = false,
Hidden = false,
Disabled = true,
Description = "Clears the cooldown of the current user.",
AdminLevel = "Admins",
Function = function(plr, args)
table.remove(cooldowndata, plr.UserId)
server.Remote.MakeGui(plr, "Hint", {
Message = "Your call cooldown has been reset",
})
end,
}
server.Remote.Commands.SendReport = function(plr, args)
-- Checking if we have the args before continuing further
assert(args[1], "Missing player name")
assert(args[2], "Missing reason")
assert(args[3], "Missing extra notes")
--// Variables
local userId = plr.UserId
local filtered = TextService:FilterStringAsync(args[2], plr.UserId)
local extranotes = TextService:FilterStringAsync(args[3], plr.UserId)
local admins = service.GetPlayers(plr, "admins")
local InGameAdmins = {}
--// Main Code
for i, v in pairs(service.GetPlayers(plr, args[1])) do
reportedplr = v
break
end
if not reportedplr and args[1] ~= "Server" then
Anti.Detected(plr,"log",`Attempted to report a player not in the server`)
return Remote.MakeGui(plr, "Output", {
Message = "Player you reported is not in the server!",
})
elseif Admin.GetLevel(reportedplr) > 1 then
Anti.Detected(plr,"log",`Attempted to report an moderator: {reportedplr.Name}`)
return Remote.MakeGui(plr, "Output", {
Message = "No.",
})
elseif plr.Name and plr.Name == reportedplr.Name then
return server.Remote.MakeGui(plr, "Output", {
Message = "You cannot report yourself!",
})
end
local EmbedData = {}
EmbedData.title = Asset.Name or "Something went wrong!"
EmbedData.url = "https://www.roblox.com/games/" .. placeId .. "/redirect"
EmbedData.description = "["
.. plr.Name
.. "](https://www.roblox.com/users/"
.. plr.UserId
.. "/profile) has sent in a report\n\n"
EmbedData.thumbnail = {
url = "https://www.astracorp.xyz/headshot-thumbnail/image?userId="
.. userId
.. "&width=420&height=420&format=png",
}
EmbedData.fields = {
{
name = "Reporting",
value = "["
.. reportedplr.Name
.. "](https://www.roblox.com/users/"
.. reportedplr.UserId
.. "/profile)",
},
{ name = "Reason", value = filtered:GetNonChatStringForUserAsync(plr.UserId) },
{ name = "Extra notes", value = extranotes:GetNonChatStringForUserAsync(plr.UserId) },
{ name = "Join Command", value = `{Settings.Prefix}jplace me {game.JobId}`},
{
name = "Join Link",
value = `https://www.astracorp.xyz/game-launch?placeId={placeId}&jobId={game.JobId}`
},
{
name = "Players",
value = #service.GetPlayers() or 0 .. "/" .. service.Players.MaxPlayers or 0,
inline = true,
},
{ name = "Time Reported", value = "<t:" .. tostring(os.time()) .. ":R>", inline = true },
{
name = "Server type",
value = tostring(getServerType() or "Something failed when fetching the server type"),
inline = true,
},
}
if #admins >= 1 then
for i, v in ipairs(admins) do
table.insert(InGameAdmins, `[{v.Name}](https://www.roblox.com/users/{v.UserId}/profile)`)
end
table.insert(
EmbedData.fields,
{ name = "Admins In-Game", value = table.concat(InGameAdmins, ","), inline = false }
)
end
local Data = {
["content"] = PluginSettings.TextContent,
["embeds"] = { EmbedData }
}
--Core.CrossServer(
-- "ExploitNotif",
-- plr.Name,
-- '<font size="29">From ' .. plr.Name .. "</font><br/>" .. reportedplr.Name .. " - " .. tostring(args[2]),
-- game.JobId
--)
local request
local success, msg = pcall(function()
request = service.HttpService:RequestAsync({
Url = `{PluginSettings.BaseURL}{PluginSettings.Webhook}`,
Method = "POST",
Headers = {
["Content-Type"] = "application/json",
["Access-Key"] = PluginSettings.APIKey,
},
Body = service.HttpService:JSONEncode(Data),
})
end)
if success then
if request.StatusCode == 200 then
cooldowndata[plr.UserId] = true
server.Remote.MakeGui(plr, "Output", {
Message = "Your report was successfully sent!",
})
table.insert(cooldowndata, plr.UserId)
else
server.Remote.MakeGui(plr, "Output", {
Message = "Something went wrong while sending your call!",
})
end
else
server.Remote.MakeGui(plr, "Output", {
Message = "Something went wrong while sending your call!",
})
end
Routine(function()
cooldowndata[plr.UserId] = true
task.wait(PluginSettings.CallCooldown)
cooldowndata[plr.UserId] = nil
end)
end
end;