diff --git a/discord-bot/bot.js b/discord-bot/bot.js
index 507a2f88..e2428b56 100644
--- a/discord-bot/bot.js
+++ b/discord-bot/bot.js
@@ -256,28 +256,181 @@ http
return;
}
- if (req.url === "/register-commands" && req.method === "POST") {
- // Verify admin token if provided
- const authHeader = req.headers.authorization;
- const adminToken = process.env.DISCORD_ADMIN_REGISTER_TOKEN;
+ if (req.url === "/register-commands") {
+ if (req.method === "GET") {
+ // Show HTML form with button
+ res.writeHead(200, { "Content-Type": "text/html" });
+ res.end(`
+
+
+
+ Register Discord Commands
+
+
+
+
+
🤖 Discord Commands Registration
+
Click the button below to register all Discord slash commands (/verify, /set-realm, /profile, /unlink, /verify-role)
- if (adminToken && authHeader !== `Bearer ${adminToken}`) {
- res.writeHead(401);
- res.end(JSON.stringify({ error: "Unauthorized" }));
+
+
+
⏳ Registering... please wait...
+
+
+
+
+
+
+ `);
return;
}
- // Register commands
- registerDiscordCommands().then((result) => {
- if (result.success) {
- res.writeHead(200);
- res.end(JSON.stringify(result));
- } else {
- res.writeHead(500);
- res.end(JSON.stringify(result));
+ if (req.method === "POST") {
+ // Verify admin token if provided
+ const authHeader = req.headers.authorization;
+ const adminToken = process.env.DISCORD_ADMIN_REGISTER_TOKEN;
+
+ if (adminToken && authHeader !== `Bearer ${adminToken}`) {
+ res.writeHead(401);
+ res.end(JSON.stringify({ error: "Unauthorized" }));
+ return;
}
- });
- return;
+
+ // Register commands
+ registerDiscordCommands().then((result) => {
+ if (result.success) {
+ res.writeHead(200);
+ res.end(JSON.stringify(result));
+ } else {
+ res.writeHead(500);
+ res.end(JSON.stringify(result));
+ }
+ });
+ return;
+ }
}
res.writeHead(404);