Ethereal <3
Ethereal <3
DIAdiscord.js - Imagine a boo! 👻
Created by Ethereal <3 on 7/16/2023 in #djs-questions
Code saying the command doesn't exist
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;

const command = interaction.client.commands.get(interaction.commandName);

if (!command) {
console.error(interaction);
return;
}

try {
await command.execute(interaction);
} catch (error) {
console.error(error);

const errorID = toString(Math.floor(Math.random() * 1000000000));

const errorEmbedServer = new EmbedBuilder()
.setTitle("Critical Error")
.setDescription(`The user ${interaction.user.username} (${interaction.user.id}) has encountered a critical error.`)
.addFields(
{"name": "Command", "value": interaction.commandName, "inline": true},
{"name": "ErrorID", "value": errorID, "inline": true},
{"name": "Error", "value": `\`\`\`${error.stack}\`\`\``}
)
.setColor("RED")

const errorEmbedUser = new EmbedBuilder()
.setTitle("Critical Error")
.setDescription(`Uh Oh, it looks like you've encountered a critical error. Please contact the developers with the errorID of \`${errorID}\``)
.setColor("RED")

logs.createLog(`error-${errorID}`, error.stack); logs.pushLogsToFiles();

interaction.client.channels.fetch(clientData.errorChannel).then(channel => {
channel.send({ embeds: [errorEmbedServer] });
});

if (interaction.replied || interaction.deferred) {
await interaction.followUp({ embeds: [errorEmbedUser], ephemeral: true });
} else {
await interaction.reply({ embeds: [errorEmbedUser], ephemeral: true });
}
}
});
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;

const command = interaction.client.commands.get(interaction.commandName);

if (!command) {
console.error(interaction);
return;
}

try {
await command.execute(interaction);
} catch (error) {
console.error(error);

const errorID = toString(Math.floor(Math.random() * 1000000000));

const errorEmbedServer = new EmbedBuilder()
.setTitle("Critical Error")
.setDescription(`The user ${interaction.user.username} (${interaction.user.id}) has encountered a critical error.`)
.addFields(
{"name": "Command", "value": interaction.commandName, "inline": true},
{"name": "ErrorID", "value": errorID, "inline": true},
{"name": "Error", "value": `\`\`\`${error.stack}\`\`\``}
)
.setColor("RED")

const errorEmbedUser = new EmbedBuilder()
.setTitle("Critical Error")
.setDescription(`Uh Oh, it looks like you've encountered a critical error. Please contact the developers with the errorID of \`${errorID}\``)
.setColor("RED")

logs.createLog(`error-${errorID}`, error.stack); logs.pushLogsToFiles();

interaction.client.channels.fetch(clientData.errorChannel).then(channel => {
channel.send({ embeds: [errorEmbedServer] });
});

if (interaction.replied || interaction.deferred) {
await interaction.followUp({ embeds: [errorEmbedUser], ephemeral: true });
} else {
await interaction.reply({ embeds: [errorEmbedUser], ephemeral: true });
}
}
});
everytime I execute the command it says: [ERROR] command ping wasn't found even though it was successfully registered. Here's my slash command file:
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
description: 'Replies with Pong!',
permissions: [],
isHidden: true,

data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!'),
async execute(interaction) {
await interaction.reply('Pong!');
},
};
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
description: 'Replies with Pong!',
permissions: [],
isHidden: true,

data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!'),
async execute(interaction) {
await interaction.reply('Pong!');
},
};
9 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Ethereal <3 on 7/12/2023 in #djs-questions
Getting error TypeError: client.actions.InteractionCreate.hasPermissionshandle is not a function
I'm getting the error TypeError: client.actions.InteractionCreate.hasPermissionshandle is not a function for some reason and I can't figure it out https://pastebin.com/yYf9kj5N
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Ethereal <3 on 6/29/2023 in #djs-questions
Interactions Endpoint Instead?
Is there a way for Discord.js to use a interaction endpoint instead of over a gateway?
8 replies