diff --git a/commands/trello/functions/createCard.js b/commands/trello/functions/createCard.js index c5715b2..bf4f5c8 100644 --- a/commands/trello/functions/createCard.js +++ b/commands/trello/functions/createCard.js @@ -6,9 +6,10 @@ const { colorInfo } = require("../data/colorInfo"); const { toTitleCase } = require("../../../utils/toTitleCase"); const { logger } = require("../../../utils/logger"); -const createCard = async (interaction, board) => { +const createCard = async (interaction) => { const fetch = (await import("node-fetch")).default; + const board = interaction.options.getString("board"); const type = interaction.options.getString("type"); const title = interaction.options.getString("title"); const description = interaction.options.getString("description"); diff --git a/commands/trello/hivemindCard.js b/commands/trello/hivemindCard.js deleted file mode 100644 index afbbf00..0000000 --- a/commands/trello/hivemindCard.js +++ /dev/null @@ -1,41 +0,0 @@ -const { SlashCommandBuilder } = require("discord.js"); -const { createCard } = require("./functions/createCard"); - -module.exports = { - data: new SlashCommandBuilder() - .setName("hivemindcard") - .setDescription("Creates Trello card in Hivemind board") - .addStringOption((option) => - option - .setName("type") - .setDescription("Type of card") - .setRequired(true) - .addChoices( - { name: "Bug", value: "bug" }, - { name: "Spike", value: "spike" }, - { name: "Task", value: "task" } - ) - ) - .addStringOption((option) => option.setName("title").setDescription("Title of card").setRequired(true)) - .addStringOption((option) => - option.setName("description").setDescription("Inner card content").setRequired(true) - ) - .addStringOption((option) => - option - .setName("repo") - .setDescription("For frontend or backend") - .setRequired(false) - .addChoices({ name: "FE", value: "fe" }, { name: "BE", value: "be" }) - ) - .addStringOption((option) => - option - .setName("assignment") - .setDescription("Assign to") - .setRequired(false) - .addChoices({ name: "Tom", value: "tom" }, { name: "Rob", value: "rob" }) - ), - - async execute(interaction) { - await createCard(interaction, "hivemind"); - }, -}; diff --git a/commands/trello/mtgCard.js b/commands/trello/mtgCard.js deleted file mode 100644 index b62c113..0000000 --- a/commands/trello/mtgCard.js +++ /dev/null @@ -1,41 +0,0 @@ -const { SlashCommandBuilder } = require("discord.js"); -const { createCard } = require("./functions/createCard"); - -module.exports = { - data: new SlashCommandBuilder() - .setName("mtgcard") - .setDescription("Creates Trello card in MTG board") - .addStringOption((option) => - option - .setName("type") - .setDescription("Type of card") - .setRequired(true) - .addChoices( - { name: "Bug", value: "bug" }, - { name: "Spike", value: "spike" }, - { name: "Task", value: "task" } - ) - ) - .addStringOption((option) => option.setName("title").setDescription("Title of card").setRequired(true)) - .addStringOption((option) => - option.setName("description").setDescription("Inner card content").setRequired(true) - ) - .addStringOption((option) => - option - .setName("repo") - .setDescription("For frontend or backend") - .setRequired(false) - .addChoices({ name: "FE", value: "fe" }, { name: "BE", value: "be" }) - ) - .addStringOption((option) => - option - .setName("assignment") - .setDescription("Assign to") - .setRequired(false) - .addChoices({ name: "Tom", value: "tom" }, { name: "Rob", value: "rob" }) - ), - - async execute(interaction) { - await createCard(interaction, "mtg"); - }, -}; diff --git a/commands/trello/dndCard.js b/commands/trello/trelloCard.js similarity index 73% rename from commands/trello/dndCard.js rename to commands/trello/trelloCard.js index f193f66..cf30727 100644 --- a/commands/trello/dndCard.js +++ b/commands/trello/trelloCard.js @@ -3,8 +3,19 @@ const { createCard } = require("./functions/createCard"); module.exports = { data: new SlashCommandBuilder() - .setName("dndcard") - .setDescription("Creates Trello card in DnD board") + .setName("trellocard") + .setDescription("Creates Trello card in selected board") + .addStringOption((option) => + option + .setName("board") + .setDescription("Select project board") + .setRequired(true) + .addChoices( + { name: "DnD", value: "dnd" }, + { name: "Hivemind", value: "hivemind" }, + { name: "MTG", value: "mtg" } + ) + ) .addStringOption((option) => option .setName("type") @@ -36,6 +47,6 @@ module.exports = { ), async execute(interaction) { - await createCard(interaction, "dnd"); + await createCard(interaction); }, };