Adds a discord-presence Payload Global as the single source of truth for the bot's Discord activity. Two writers update it and either takes effect live: the admin CMS page and the /discord-presence command (view/edit/clear, guild-only, gated by new discord:rp:read and discord:rp:update permissions). A poll loop reconciles Discord's live presence from the Global so CMS edits propagate without a restart; disabled or blank presence sets the bot idle.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import type { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
|
|
import type { Payload } from "payload";
|
|
import { pingCommand } from "./ping";
|
|
import { signupCommand } from "./signup";
|
|
import { linkCommand } from "./link";
|
|
import { announceCommand } from "./announce";
|
|
import { changelogCommand } from "./changelog";
|
|
import { remindEvaluationsCommand } from "./remindEvaluations";
|
|
import { rollCallCommand } from "./rollcall";
|
|
import { discordPresenceCommand } from "./discordPresence";
|
|
|
|
export interface BotCommand {
|
|
builder: SlashCommandBuilder;
|
|
execute: (interaction: ChatInputCommandInteraction, payload: Payload) => Promise<void> | void;
|
|
/**
|
|
* Registration scope. "global" = available in DMs and every guild the bot is
|
|
* in; "guild" (default) = only the configured guild. Discord never exposes
|
|
* guild-scoped commands in DMs, so DM-only commands like /signup must be global.
|
|
*/
|
|
scope?: "global" | "guild";
|
|
}
|
|
|
|
export const commands: BotCommand[] = [
|
|
pingCommand,
|
|
signupCommand,
|
|
linkCommand,
|
|
announceCommand,
|
|
changelogCommand,
|
|
remindEvaluationsCommand,
|
|
rollCallCommand,
|
|
discordPresenceCommand,
|
|
];
|