Interaction type not defined

ReferenceError: InteractionType is not defined at Object.execute (C:\Users\luizs\Documents\Discord Bot\Events\Interactions\interactionCreate.js:8:29) at Client.<anonymous> (C:\Users\luizs\Documents\Discord Bot\Handlers\eventHandler.js:25:63) at Client.emit (node:events:513:28) at InteractionCreateAction.handle (C:\Users\luizs\Documents\Discord Bot\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12) at module.exports [as INTERACTION_CREATE] (C:\Users\luizs\Documents\Discord Bot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36) at WebSocketManager.handlePacket (C:\Users\luizs\Documents\Discord Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31) at WebSocketShard.onPacket (C:\Users\luizs\Documents\Discord Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:489:22) at WebSocketShard.onMessage (C:\Users\luizs\Documents\Discord Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:328:10) at callListener (C:\Users\luizs\Documents\Discord Bot\node_modules\ws\lib\event-target.js:290:14) at WebSocket.onMessage (C:\Users\luizs\Documents\Discord Bot\node_modules\ws\lib\event-target.js:209:9) Emitted 'error' event on Client instance at: at emitUnhandledRejectionOrErr (node:events:394:10) at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
9 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Ashura
AshuraOP2y ago
const { CommandInteraction } = require("discord.js");

module.exports = {
name: "interactionCreate",

async execute(interaction, client) {
if(interaction.type == InteractionType.ApplicationCommandAutoComplete){
const {commands} = client;
const {commandName} = interaction;
const command = commands.get(commandName);
if (!command) return;

try {
await command.autocomplete(interaction, client)
} catch (err){
console.error(error);
}
}
},
};
const { CommandInteraction } = require("discord.js");

module.exports = {
name: "interactionCreate",

async execute(interaction, client) {
if(interaction.type == InteractionType.ApplicationCommandAutoComplete){
const {commands} = client;
const {commandName} = interaction;
const command = commands.get(commandName);
if (!command) return;

try {
await command.autocomplete(interaction, client)
} catch (err){
console.error(error);
}
}
},
};
Parogo_72
Parogo_722y ago
Import it from discord.js
Ashura
AshuraOP2y ago
Autocompleteinteraction?
Parogo_72
Parogo_722y ago
InteractionType...
Ashura
AshuraOP2y ago
k thx still not defined same error
Parogo_72
Parogo_722y ago
What did you do
Ashura
AshuraOP2y ago
const { CommandInteraction, ApplicationCommandAutoComplete } = require("discord.js");

module.exports = {
name: "interactionCreate",

async execute(interaction, client) {
if(interaction.type == InteractionType.ApplicationCommandAutoComplete){
const {commands} = client;
const {commandName} = interaction;
const command = commands.get(commandName);
if (!command) return;

try {
await command.autocomplete(interaction, client)
} catch (err){
console.error(error);
}
}
},
};
const { CommandInteraction, ApplicationCommandAutoComplete } = require("discord.js");

module.exports = {
name: "interactionCreate",

async execute(interaction, client) {
if(interaction.type == InteractionType.ApplicationCommandAutoComplete){
const {commands} = client;
const {commandName} = interaction;
const command = commands.get(commandName);
if (!command) return;

try {
await command.autocomplete(interaction, client)
} catch (err){
console.error(error);
}
}
},
};
Parogo_72
Parogo_722y ago
You didnt do what I said I told you to import InteractionType
Want results from more Discord servers?
Add your server