Wishlist: Command boilerplate

This commit is contained in:
2023-03-15 15:31:02 +01:00
parent b8ffa9fd94
commit b8db85e71c
2 changed files with 58 additions and 0 deletions

53
commands/wishlist.js Normal file
View File

@@ -0,0 +1,53 @@
const { SlashCommandBuilder } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("wishlist")
.setDescription("View, edit or compare your wishlist")
.addSubcommand((subcommand) =>
subcommand
.setName("view")
.setDescription("View your wishlist"))
.addSubcommand((subcommand) =>
subcommand
.setName("compare")
.setDescription("Compare your wishlist with a users collection")
.addUserOption((option) =>
option
.setName("user")
.setDescription("User to compare with")
.setRequired(true)
))
.addSubcommand((subcommand) =>
subcommand
.setName("edit")
.setDescription("Add or remove a character from your wishlist")
.addStringOption((option) =>
option
.setName("character")
.setDescription("Character to add/remove")
.setRequired(true)
.setAutocomplete(true)
)
),
permissionLevel: 1,
async execute(interaction) {
await interaction.deferReply();
switch (interaction.options.getSubcommand()) {
case "view":
await interaction.editReply("Viewing your wishlist");
break;
case "compare":
await interaction.editReply("Comparing your wishlist");
break;
case "edit":
await interaction.editReply("Editing your wishlist");
break;
default:
await interaction.editReply("hmmm");
break;
}
}
}

View File

@@ -39,6 +39,11 @@ module.exports = {
break; break;
} }
} }
if (interaction.commandName === 'wishlist') {
choices = (await SearchUtils.findByName(Character, focusedOption.value))["choices"];
}
if (interaction.commandName === 'collection') { if (interaction.commandName === 'collection') {
const character = interaction.options.getString('character'); const character = interaction.options.getString('character');
const group = interaction.options.getString('group'); const group = interaction.options.getString('group');