So, for context, this is the only command that is currently doing this. It is giving absolutely nothing in the console and it says on Discord “The application did not respond.”. It seems to be correct, I’m just not sure why it isn’t working. Here is the code:
const family = require("../../schemas/familySchema.js");
const {
SlashCommandBuilder,
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
EmbedBuilder,
ComponentType,
} = require("discord.js");
const mongoose = require("mongoose");
module.exports = {
cooldown: 10,
data: new SlashCommandBuilder()
.setName("family")
.setDescription("Handle all Family related tasks.")
.addSubcommand((subcommand) =>
subcommand
.setName("marry")
.setDescription("Lets you propose to another user.")
.addUserOption((option) =>
option
.setName("target")
.setDescription("Pick who you want to Marry.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("divorce")
.setDescription("Divorce you from one of your partners.")
.addUserOption((option) =>
option
.setName("target")
.setDescription("Pick who you want to Divorce.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("adopt")
.setDescription("Adopt another user into your family.")
.addUserOption((option) =>
option
.setName("target")
.setDescription("Pick who you want to Adopt.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("disown")
.setDescription("Removes someone from being your child.")
.addUserOption((option) =>
option
.setName("target")
.setDescription("Pick who you want to Disown.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("makeparent")
.setDescription("Picks a user that you want to be your parent.")
.addUserOption((option) =>
option
.setName("target")
.setDescription("Pick who you want to be your Parent.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("runaway")
.setDescription("Removes your parent.")
.addUserOption((option) =>
option
.setName("target")
.setDescription("Pick who you want to remove as your parent.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("partner")
.setDescription("Tells you who a user is married to.")
.addUserOption((option) =>
option
.setName("target")
.setDescription("Pick who you want to know the partners of.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("children")
.setDescription("Tells you who a user's children are.")
.addUserOption((option) =>
option
.setName("target")
.setDescription("Pick who you want to know the children of.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("sibling")
.setDescription("Tells you who a user's siblings are.")
.addUserOption((option) =>
option
.setName("target")
.setDescription("Pick who you want to know the siblings of.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("parent")
.setDescription("Tells you who someone's parents are.")
.addUserOption((option) =>
option
.setName("target")
.setDescription("Pick who you want to know the parents of.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("familytree")
.setDescription("Gets the full family tree of a user.")
.addUserOption((option) =>
option
.setName("target")
.setDescription(
"Pick who you want to know the family tree of.",
)
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("relationship")
.setDescription("Gets the relationship between two users.")
.addUserOption((option) =>
option
.setName("target")
.setDescription("Pick the first user.")
.setRequired(true),
)
.addUserOption((option) =>
option
.setName("othertarget")
.setDescription("Pick the second user.")
.setRequired(true),
),
),
async execute(interaction) {
const target = interaction.options.getUser("target");
const user = await interaction.guild.members.fetch(
interaction.user.id,
);
const check = family.findOne({ userid: user.id });
const checkTarget = family.findOne({ userid: target.id });
switch (interaction.options.getSubCommand) {
case "marry": {
if (!check) {
check = new family({
_id: new mongoose.Types.ObjectId(),
userid: user.id,
partnerids: [],
childrenids: [],
parentids: [],
siblingids: [],
});
}
if (!checkTarget) {
check = new family({
_id: new mongoose.Types.ObjectId(),
userid: target.id,
partnerids: [],
childrenids: [],
parentids: [],
siblingids: [],
});
}
const ido = new ButtonBuilder()
.setCustomId("ido")
.setLabel("I do")
.setStyle(ButtonStyle.Success);
const no = new ButtonBuilder()
.setCustomId("no")
.setLabel("No")
.setStyle(ButtonStyle.Danger);
const marryRow = new ActionRowBuilder().addComponents(ido, no);
await interaction.channel.send({
content: `Will you marry <@${user.id}>? <@${target.id}>`,
components: [marryRow],
});
const filter = (i) => i.user.id === target.id;
const collector = reply.createMessageComponentCollector({
ComponentType: ComponentType.Button,
filter,
});
collector.on("collect", (interaction) => {
if (interaction.customId === "ido") {
try {
check.partnerids.push(target.id);
checkTarget.partnerids.push(user.id);
} catch (e) {
return console.log(`An error occured!`);
}
const embed = new EmbedBuilder()
.setTitle(
`${user.displayName} and ${target.displayName} got hitched!`,
)
.setColor(0x0099ff);
interaction.channel.send({ embeds: });
}
if (interaction.customId === "no") {
const embed = new EmbedBuilder()
.setTitle(
`${target.displayName} declined ${user.displayName}!`,
)
.setColor(0x0099ff);
interaction.channel.send({ embeds: });
}
});
await check.save().catch(console.error);
}
}
},
};
I’ve tried looking around, but could not find any information that would help me resolve the issue. For reference, I’m not done. I am simply trying to test the first concept to see if it works.