Hi Developers!
I’m wondering if there’s a Moderation API that I could add to a External Admin Panel for my game. I have a Custom Admin Panel made using HTML, and I’d like the site to list any banned players and allow me to Add and Remove a ban, Like you would in the Moderation Tab for your game (https://create.roblox.com/dashboard/creations/experiences/ID_HERE/moderation/bans )
MrSuperKrut
(BarelyUnbearable)
November 7, 2024, 11:26pm
#2
I think it’s this ? Don’t know the answer tbh
1 Like
I tried that, I might have made the script wrong tho
import { BaseURL, UniverseID, PlaceID, ApiKey } from './Roblox-Api.js';
function banUser() {
const username = document.getElementById("usernameInput").value.trim();
const userId = document.getElementById("idInput").value.trim();
const reason = document.getElementById("reasonSelect").value;
const restrictionType = "ban";
if (!username || !userId) {
alert("Please fill in both the Username and ID fields.");
return;
}
const apiUrl = `${BaseURL}/v2/universes/${UniverseID}/places/${PlaceID}/user-restrictions/${restrictionType}`;
const banData = { userId, reason, restrictionType };
fetch(apiUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${ApiKey}`
},
body: JSON.stringify(banData)
})
.then(response => {
if (response.ok) {
addUserToTable({ username, id: userId, reason, length: document.getElementById("lengthSelect").value });
alert(`User ${username} has been successfully banned.`);
} else {
return response.json().then(data => alert(`Failed to ban user: ${data.message || "Unknown error"}`));
}
})
.catch(error => console.error("An error occurred:", error));
}
MrSuperKrut
(BarelyUnbearable)
November 7, 2024, 11:37pm
#4
Isn’t it a PATCH method? Sorry, not a very good web developer hehe, I would try this PATCH /cloud/v2/universes/{universe}/user-restrictions/{user-restriction
Nope, That doesn’t work either
MrSuperKrut
(BarelyUnbearable)
November 7, 2024, 11:40pm
#6
What’s the response at least? Dhdhdjsjsjjdjd
Nothing happens, I click the Ban button and nothing happens
MrSuperKrut
(BarelyUnbearable)
November 7, 2024, 11:43pm
#8
I mean like just print out the response in a console, and see if a script actually runs, I think it’s console.log()