Files
BattleBot/deploy-commands.js
VinceC 3453be6947 Dev (#12)
* health check

* Update Dockerfile

* simplifying the deployment

* Update Bot.js

makes the find team command public

* test (#9)

* Dev (#7)

* health check

* Update Dockerfile

* simplifying the deployment

* Dev (#8)

* health check

* Update Dockerfile

* simplifying the deployment

* Update Bot.js

makes the find team command public

* Update PlayerService.js

* massive update????

could break stuff

* Update Bot.js

update
2025-07-07 21:38:19 -05:00

124 lines
3.9 KiB
JavaScript

const { REST, Routes, SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
require("dotenv").config();
const commands = [
new SlashCommandBuilder()
.setName("ping")
.setDescription("Replies with Pong!"),
new SlashCommandBuilder()
.setName("help")
.setDescription("Get help with BattleBot commands and features")
.addStringOption((option) =>
option
.setName("category")
.setDescription("Choose a help category")
.setRequired(false)
.addChoices(
{ name: "🏠 Getting Started", value: "getting_started" },
{ name: "🔍 Search Commands", value: "search" },
{ name: "⚙️ Admin & Setup", value: "admin" },
{ name: "🔔 Notifications", value: "notifications" },
{ name: "❓ Troubleshooting", value: "troubleshooting" }
)
),
new SlashCommandBuilder()
.setName("finduser")
.setDescription("Find a user by username")
.addStringOption((option) =>
option
.setName("game")
.setDescription("Select the game")
.setRequired(true)
.setAutocomplete(true)
)
.addStringOption((option) =>
option
.setName("username")
.setDescription("The username to search for")
.setRequired(true)
),
new SlashCommandBuilder()
.setName("matchhistory")
.setDescription("View match history")
.addStringOption((option) =>
option
.setName("username")
.setDescription("The username to search for")
.setRequired(true)
)
.addStringOption((option) =>
option.setName("game").setDescription("Filter by game").setRequired(false).setAutocomplete(true)
),
new SlashCommandBuilder()
.setName("subscribe")
.setDescription("Subscribe to game notifications")
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addStringOption((option) =>
option
.setName("game")
.setDescription("Game to subscribe to")
.setRequired(true)
.setAutocomplete(true)
)
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("Channel for notifications")
.setRequired(true)
),
new SlashCommandBuilder()
.setName("unsubscribe")
.setDescription("Unsubscribe from game notifications")
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addStringOption((option) =>
option
.setName("game")
.setDescription("Game to unsubscribe from")
.setRequired(true)
.setAutocomplete(true)
),
new SlashCommandBuilder()
.setName("register_server")
.setDescription("Register this Discord server with BattleBot")
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
new SlashCommandBuilder()
.setName("list_subscriptions")
.setDescription("List all game subscriptions for this server")
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
new SlashCommandBuilder()
.setName("findteam")
.setDescription("Find a team by name")
.addStringOption((option) =>
option
.setName("game")
.setDescription("Select the game")
.setRequired(true)
.setAutocomplete(true)
)
.addStringOption((option) =>
option
.setName("teamname")
.setDescription("The team name to search for")
.setRequired(true)
),
];
const rest = new REST({ version: "10" }).setToken(process.env.DISCORD_TOKEN);
(async () => {
try {
console.log("Started refreshing application (/) commands.");
console.log(
"Commands to be deployed:",
commands.map((cmd) => cmd.name)
);
await rest.put(Routes.applicationCommands(process.env.CLIENT_ID), {
body: commands.map((command) => command.toJSON()),
});
console.log("Successfully reloaded application (/) commands.");
} catch (error) {
console.error(error);
}
})();