mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09:37:50 -05:00
feat: add unified Discord bot and dashboard
This commit is contained in:
1 parent
113bf9342e
commit
b11ae1dfa8
14 files changed
+1708
-14
No files matched your search
@@ -9,6 +9,7 @@ const achievements = require("./achievements.js");
|
||||
const adopt = require("./adopt.js");
|
||||
const badges = require("./badges.js");
|
||||
const discordLinks = require("./discord.js");
|
||||
const discordBot = require("./discordbot.js");
|
||||
const bans = require("./bans.js");
|
||||
const colours = require("./colours.js");
|
||||
const chatlog = require("./chatlog.js");
|
||||
@@ -795,6 +796,61 @@ const handle = async (req, res, url, from, web) => {
|
||||
reply(200, overview());
|
||||
return;
|
||||
|
||||
case "GET /admin/api/discord":
|
||||
reply(200, discordBot.dashboardStatus());
|
||||
return;
|
||||
|
||||
case "POST /admin/api/discord/status": {
|
||||
const statusCard = discordBot.setStatusSettings({title: body.title, note: body.note});
|
||||
modlog.record("admin", "Discord public status card changed", "", `title: ${statusCard.title}`);
|
||||
reply(200, {ok: "Status-card text saved. Use Publish now to update Discord.", statusCard});
|
||||
return;
|
||||
}
|
||||
|
||||
case "POST /admin/api/discord/status/publish": {
|
||||
const result = await discordBot.publishStatus();
|
||||
if (result.ok) {
|
||||
modlog.record("admin", "Discord public status card published");
|
||||
}
|
||||
reply(result.ok ? 200 : 400, result);
|
||||
return;
|
||||
}
|
||||
|
||||
case "POST /admin/api/discord/config": {
|
||||
const result = discordBot.updateDashboardConfig(body);
|
||||
if (result.ok) {
|
||||
modlog.record("admin", "Discord bot routing settings changed");
|
||||
}
|
||||
reply(result.ok ? 200 : 400, result);
|
||||
return;
|
||||
}
|
||||
|
||||
case "POST /admin/api/discord/security": {
|
||||
const result = discordBot.updateSecuritySettings(body);
|
||||
if (result.ok) {
|
||||
modlog.record("admin", "Discord security settings changed");
|
||||
}
|
||||
reply(result.ok ? 200 : 400, result);
|
||||
return;
|
||||
}
|
||||
|
||||
case "POST /admin/api/discord/community": {
|
||||
const result = discordBot.updateCommunitySettings(body);
|
||||
if (result.ok) modlog.record("admin", "Discord community and ticket settings changed");
|
||||
reply(result.ok ? 200 : 400, result);
|
||||
return;
|
||||
}
|
||||
|
||||
case "POST /admin/api/discord/control": {
|
||||
const action = String(body.action || "");
|
||||
const result = await discordBot.control(action);
|
||||
if (result.ok) {
|
||||
modlog.record("admin", `Discord bot ${action}`);
|
||||
}
|
||||
reply(result.ok ? 200 : 400, result);
|
||||
return;
|
||||
}
|
||||
|
||||
// a page of accounts by name (lib/staff.js says in what order), never
|
||||
// all of them: with thousands, sending every one every few seconds
|
||||
// slowed the page and the game alike.
|
||||
|
||||
Reference in new issue
Block a user