local Feedbackw = Tabs.Feedback:AddDropdown("Feedbackw", {
Title = "Rate this script",
Description = "Please rate this seriously for future improvements",
Values = {"⭐", "⭐⭐", "⭐⭐⭐", "⭐⭐⭐⭐", "⭐⭐⭐⭐⭐"},
Multi = false,
Default = nil,
})
local Feedbackz = Tabs.Feedback:AddInput("Feedbackz", {
Title = "Reason for rating",
Default = "",
Placeholder = "Give us your feedback",
Numeric = false,
Finished = true,
Callback = function(Value)
end
})
local currentRating = nil
local currentFeedbackText = ""
local messageId = nil
local webhookUrl = "this is where id put my webhook"
local function SendFeedbackToWebhook()
if not currentRating then return end
local player = game.Players.LocalPlayer
local username = player.Name
local username2 = player.DisplayName
local placeId = game.PlaceId
local placeName = game:GetService("MarketplaceService"):GetProductInfo(placeId).Name
local embed = {
["title"] = "Feedback: " .. placeName,
["description"] = "Feedback from " .. username2,
["color"] = 3447003,
["fields"] = {
{ ["name"] = "Username", ["value"] = username, ["inline"] = true },
{ ["name"] = "Rating", ["value"] = currentRating, ["inline"] = true },
{ ["name"] = "Comments", ["value"] = currentFeedbackText ~= "" and currentFeedbackText or "No comments provided", ["inline"] = false }
}
}
local data = { ["embeds"] = { embed } }
local body = game:GetService("HttpService"):JSONEncode(data)
local headers = { ["Content-Type"] = "application/json" }
local url = messageId and (webhookUrl .. "/messages/" .. messageId) or webhookUrl
local method = messageId and "PATCH" or "POST"
if messageId then
local deleteUrl = webhookUrl .. "/messages/" .. messageId
local deleteSuccess, deleteResponse = pcall(function()
return request({
Url = deleteUrl,
Method = "DELETE",
Headers = headers
})
end)
if deleteSuccess and deleteResponse then
print("Old message deleted successfully!")
else
warn("Failed to delete old message!")
end
end
local success, response = pcall(function()
return request({
Url = url,
Method = method,
Headers = headers,
Body = body
})
end)
if success and response and response.Success then
if not messageId then
local success2, responseData = pcall(function()
return game:GetService("HttpService"):JSONDecode(response.Body)
end)
if success2 and responseData and responseData.id then
messageId = responseData.id
end
end
print("Feedback sent successfully!")
else
warn("Failed to send feedback!")
end
end
Feedbackw:OnChanged(function(Value)
currentRating = Value
SendFeedbackToWebhook()
end)
Feedbackz:OnChanged(function(Value)
currentFeedbackText = Value
if currentRating then
task.delay(1, SendFeedbackToWebhook)
end
end)
Cancel
Post