-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanager
More file actions
207 lines (180 loc) · 4.71 KB
/
manager
File metadata and controls
207 lines (180 loc) · 4.71 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
local ui = loadstring(game:HttpGet("https://github.com/Footagesus/WindUI/releases/latest/download/main.lua"))()
local notify = loadstring(game:HttpGet("https://raw.githubusercontent.com/ilovechubbyorangecat/script/refs/heads/main/notification.lua", true))()
local HttpService = game:GetService("HttpService")
local webhook, msg, del
local spam = false
local newName
local function send(txt, silent)
if not txt or txt == "" then
notify.Error("You must enter a message before sending", "Failed to send message")
return
end
if not webhook or webhook == "" then
notify.Error("Webhook is not set", "Failed to send message")
return
end
local res = http.request({
Url = webhook,
Method = "POST",
Headers = {
["Content-Type"] = "application/json"
},
Body = '{"content": "' .. txt .. '"}'
})
if not silent then
if res.StatusCode == 204 then
notify.Info("Message Sent", "Success")
else
notify.Error("Webhook Does Not Exist: " .. res.StatusCode, "Failed to send message")
end
end
end
local function validate(silent)
local res = http.request({
Url = webhook,
Method = "GET",
Headers = {
["Content-Type"] = "application/json"
}
})
if not silent then
if res.StatusCode == 200 then
notify.Info("Webhook Exists", "Valid Webhook")
else
notify.Error("Webhook Does Not Exist", "Invalid Webhook")
end
end
return res.StatusCode
end
local function delete()
if validate(true) == 200 then
local res = http.request({
Url = webhook,
Method = "DELETE"
})
if res.StatusCode == 204 then
notify.Info("Webhook Deleted", "Success")
else
notify.Error("Webhook Does Not Exist", "Failed to delete webhook")
end
end
end
local function changeWebhookName(name)
if not webhook or webhook == "" then
notify.Error("Webhook is not set", "Failed to change webhook name")
return
end
if not name or name == "" then
notify.Error("New name is empty", "Failed to change webhook name")
return
end
local res = http.request({
Url = webhook,
Method = "PATCH",
Headers = {
["Content-Type"] = "application/json"
},
Body = HttpService:JSONEncode({
name = name
})
})
if res.StatusCode == 200 then
notify.Info("Webhook name changed", "Success")
else
notify.Error("Failed to change name: " .. tostring(res.StatusCode), "Error")
end
end
local win = ui:CreateWindow({
Title = "Webhook Tool",
Icon = "door-open",
Author = "Example UI",
Folder = "CloudHub",
Size = UDim2.fromOffset(580, 460),
Transparent = true,
Theme = "Dark",
SideBarWidth = 200,
Background = "", -- rbxassetid only
BackgroundImageTransparency = 0.42,
HideSearchBar = true,
ScrollBarEnabled = false,
User = {
Enabled = true,
Anonymous = true,
Callback = function()
print("clicked")
end,
}
})
local tab = win:Tab({
Title = "Main",
Icon = "bird",
})
tab:Section({
Title = "Config",
TextXAlignment = "Left",
TextSize = 17,
})
tab:Input({
Title = "Webhook URL",
Placeholder = "Enter Webhook URL",
Callback = function(v) webhook = v end
})
tab:Input({
Title = "Message",
Placeholder = "Enter message",
Callback = function(v) msg = v end
})
tab:Input({
Title = "Spam Delay",
Value = "0.1",
Placeholder = "Enter time (seconds)",
Callback = function(v) del = v end
})
tab:Section({
Title = "Functions",
TextXAlignment = "Left",
TextSize = 17,
})
tab:Button({
Title = "Validate Webhook",
Locked = false,
Callback = function() validate() end
})
tab:Button({
Title = "Send Message",
Locked = false,
Callback = function() send(msg) end
})
tab:Toggle({
Title = "Spam Message",
Type = "Toggle",
Default = false,
Callback = function(state)
spam = state
if spam then
task.spawn(function()
while spam do
send(msg, true)
task.wait(del)
end
end)
end
end
})
tab:Input({
Title = "Webhook Name Changer",
Placeholder = "Enter webhook name",
Callback = function(v) newName = v end
})
tab:Button({
Title = "Change Webhook Name",
Locked = false,
Callback = function()
changeWebhookName(newName)
end
})
tab:Button({
Title = "Delete Webhook",
Locked = false,
Callback = function() delete() end
})