No handler available for this interaction (ApplicationCommand > add)

My code was working fine a day ago, what does this actually mean?
4 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
! Murali Anand
! Murali AnandOP2y ago
const {
SlashCommandBuilder,
EmbedBuilder,
PermissionFlagsBits
} = require('discord.js');

const ticketData = require("../../events/models/channel.js");

module.exports = {
cooldown: 10000,
userPerms: [],
botPerms: [],

data: new SlashCommandBuilder()
.setName('add')
.setDescription('Add someone to the ticket (Ticket Command) ')
.setDMPermission(false)
.addUserOption(option =>
option.setName('target')
.setDescription('Member to add to ticket')
.setRequired(true)),
async execute(interaction, client) {

const ticketDoc = await ticketData.findOne({
ticketGuildID: interaction.guild.id
}).catch(err => console.log(err));

const chan = client.channels.cache.get(interaction.channelId);
const user = interaction.options.getUser('target');
const userID = user.id;

let Support_Role = ticketDoc.ticketSupportID;

if (chan.name.includes('ticket')) {
chan.edit({
permissionOverwrites: [
{
id: userID,
allow: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.ViewChannel],
}
],
}).then(async () => {
interaction.reply({
content: `<@${user.id}> has been added to the ticket!`
});
});

} else {
const ReplyEmbed = new EmbedBuilder()
.setColor("#ED4245")
.setDescription('You are not in a Ticket!')

await interaction.reply({
embeds: [ReplyEmbed],
ephemeral: true
});
};
},
};
const {
SlashCommandBuilder,
EmbedBuilder,
PermissionFlagsBits
} = require('discord.js');

const ticketData = require("../../events/models/channel.js");

module.exports = {
cooldown: 10000,
userPerms: [],
botPerms: [],

data: new SlashCommandBuilder()
.setName('add')
.setDescription('Add someone to the ticket (Ticket Command) ')
.setDMPermission(false)
.addUserOption(option =>
option.setName('target')
.setDescription('Member to add to ticket')
.setRequired(true)),
async execute(interaction, client) {

const ticketDoc = await ticketData.findOne({
ticketGuildID: interaction.guild.id
}).catch(err => console.log(err));

const chan = client.channels.cache.get(interaction.channelId);
const user = interaction.options.getUser('target');
const userID = user.id;

let Support_Role = ticketDoc.ticketSupportID;

if (chan.name.includes('ticket')) {
chan.edit({
permissionOverwrites: [
{
id: userID,
allow: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.ViewChannel],
}
],
}).then(async () => {
interaction.reply({
content: `<@${user.id}> has been added to the ticket!`
});
});

} else {
const ReplyEmbed = new EmbedBuilder()
.setColor("#ED4245")
.setDescription('You are not in a Ticket!')

await interaction.reply({
embeds: [ReplyEmbed],
ephemeral: true
});
};
},
};
Squid
Squid2y ago
That "error" message is custom, so it's not coming from any discord.js structure We don't know what causes it to appear, so we can't help you fix it
! Murali Anand
! Murali AnandOP2y ago
FeelsBadMan
Want results from more Discord servers?
Add your server