Files
BattleBot/deploy-commands.js
VinceC dd8aa456d9 v1.2.11: Add tournaments command with filtering and improve error handling
Features:
- Add /tournaments command with status and game filters
- Add tournament API integration to PlayerService
- Add beautiful tournament embed builders with prize pools
- Protect sync-games from overwriting manual customizations
- Improve error handling with proper MessageFlags

Changes:
- Add getTournamentsData() and getTournamentData() to PlayerService
- Add tournament command handler with pagination support
- Add tournament embed builders with rich formatting
- Update deployment docs for v1.2.10 features
- Add issue tracker documentation
- Add tournament testing script
- Fix ephemeral flags throughout CommandHandler
- Improve permission checks with PermissionFlagsBits

Version: 1.2.11
2025-10-02 06:24:54 -05:00

213 lines
7.6 KiB
JavaScript

const { REST, Routes, SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
require("dotenv").config();
const commands = [
new SlashCommandBuilder()
.setName("help")
.setDescription("Get help with BattleBot commands and features")
.addStringOption((option) =>
option
.setName("category")
.setDescription("Select a help category")
.setRequired(false)
.addChoices(
{ name: "Big Ballers VR", value: "Big Ballers VR" },
{ name: "Blacktop Hoops", value: "Blacktop Hoops" },
{ name: "Breachers", value: "Breachers" },
{ name: "Echo Arena", value: "Echo Arena" },
{ name: "Echo Combat", value: "Echo Combat" },
{ name: "Gun Raiders", value: "Gun Raiders" },
{ name: "Nock", value: "Nock" },
{ name: "Orion Drift", value: "Orion Drift" },
{ name: "VAIL", value: "VAIL" }
)
),
new SlashCommandBuilder()
.setName("version")
.setDescription("Show bot version and system information"),
new SlashCommandBuilder()
.setName("finduser")
.setDescription("Find a user by username")
.addStringOption((option) =>
option
.setName("game")
.setDescription("Select the game")
.setRequired(true)
.addChoices(
{ name: "Big Ballers VR", value: "Big Ballers VR" },
{ name: "Blacktop Hoops", value: "Blacktop Hoops" },
{ name: "Breachers", value: "Breachers" },
{ name: "Echo Arena", value: "Echo Arena" },
{ name: "Echo Combat", value: "Echo Combat" },
{ name: "Gun Raiders", value: "Gun Raiders" },
{ name: "Nock", value: "Nock" },
{ name: "Orion Drift", value: "Orion Drift" },
{ name: "VAIL", value: "VAIL" }
)
)
.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 (optional)")
.setRequired(false)
.addChoices(
{ name: "Big Ballers VR", value: "Big Ballers VR" },
{ name: "Blacktop Hoops", value: "Blacktop Hoops" },
{ name: "Breachers", value: "Breachers" },
{ name: "Echo Arena", value: "Echo Arena" },
{ name: "Echo Combat", value: "Echo Combat" },
{ name: "Gun Raiders", value: "Gun Raiders" },
{ name: "Nock", value: "Nock" },
{ name: "Orion Drift", value: "Orion Drift" },
{ name: "VAIL", value: "VAIL" }
)
),
new SlashCommandBuilder()
.setName("subscribe")
.setDescription("Subscribe to game notifications")
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addStringOption((option) =>
option
.setName("game")
.setDescription("Game to subscribe to")
.setRequired(true)
.addChoices(
{ name: "Big Ballers VR", value: "Big Ballers VR" },
{ name: "Blacktop Hoops", value: "Blacktop Hoops" },
{ name: "Breachers", value: "Breachers" },
{ name: "Echo Arena", value: "Echo Arena" },
{ name: "Echo Combat", value: "Echo Combat" },
{ name: "Gun Raiders", value: "Gun Raiders" },
{ name: "Nock", value: "Nock" },
{ name: "Orion Drift", value: "Orion Drift" },
{ name: "VAIL", value: "VAIL" }
)
)
.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)
.addChoices(
{ name: "Big Ballers VR", value: "Big Ballers VR" },
{ name: "Blacktop Hoops", value: "Blacktop Hoops" },
{ name: "Breachers", value: "Breachers" },
{ name: "Echo Arena", value: "Echo Arena" },
{ name: "Echo Combat", value: "Echo Combat" },
{ name: "Gun Raiders", value: "Gun Raiders" },
{ name: "Nock", value: "Nock" },
{ name: "Orion Drift", value: "Orion Drift" },
{ name: "VAIL", value: "VAIL" }
)
),
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)
.addChoices(
{ name: "Big Ballers VR", value: "Big Ballers VR" },
{ name: "Blacktop Hoops", value: "Blacktop Hoops" },
{ name: "Breachers", value: "Breachers" },
{ name: "Echo Arena", value: "Echo Arena" },
{ name: "Echo Combat", value: "Echo Combat" },
{ name: "Gun Raiders", value: "Gun Raiders" },
{ name: "Nock", value: "Nock" },
{ name: "Orion Drift", value: "Orion Drift" },
{ name: "VAIL", value: "VAIL" }
)
)
.addStringOption((option) =>
option
.setName("teamname")
.setDescription("The team name to search for")
.setRequired(true)
),
new SlashCommandBuilder()
.setName("tournaments")
.setDescription("View all available tournaments")
.addStringOption((option) =>
option
.setName("status")
.setDescription("Filter tournaments by status (optional)")
.setRequired(false)
.addChoices(
{ name: "📢 Published", value: "Published" },
{ name: "⚡ In-progress", value: "In-progress" },
{ name: "🏁 Ended", value: "Ended" }
)
)
.addStringOption((option) =>
option
.setName("game")
.setDescription("Filter tournaments by game (optional)")
.setRequired(false)
.addChoices(
{ name: "Big Ballers VR", value: "Big Ballers VR" },
{ name: "Blacktop Hoops", value: "Blacktop Hoops" },
{ name: "Breachers", value: "Breachers" },
{ name: "Echo Arena", value: "Echo Arena" },
{ name: "Echo Combat", value: "Echo Combat" },
{ name: "Gun Raiders", value: "Gun Raiders" },
{ name: "Nock", value: "Nock" },
{ name: "Orion Drift", value: "Orion Drift" },
{ name: "VAIL", value: "VAIL" }
)
),
];
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);
}
})();