HeartSpirit
HeartSpirit
DIAdiscord.js - Imagine an app
Created by HeartSpirit on 7/6/2023 in #djs-questions
prefix command not working
I tried to add the commands in separate files, but it did not turn out to be comfortable for me, it also did not work, so I wanted to add them in the same index, it turns out that it does not work either, I chose to add a console.log to see if the client.on ('messageCreate') was executed correctly, someone help me?
const { Client, Collection, GatewayIntentBits, Partials, SlashCommandBuilder } = require('discord.js');

const client = new Client({ intents: [GatewayIntentBits.Guilds], partials: [Partials.Channel] });

client.config = require('./config.json');

client.once('ready', async () => {
await client.user.setPresence({
activities: [{
name: 'game',
ActivityType: 'PLAYING'
}],
status: 'online'
});

console.log('Ready bot');

//commands Slash and register commands slash
});

client.on('interactionCreate', async (interaction) => {
const { commandName, options } = interaction;

// comands slash
});

const prefix = '!';

client.on('message', message =>{
//commands prefix
});
const { Client, Collection, GatewayIntentBits, Partials, SlashCommandBuilder } = require('discord.js');

const client = new Client({ intents: [GatewayIntentBits.Guilds], partials: [Partials.Channel] });

client.config = require('./config.json');

client.once('ready', async () => {
await client.user.setPresence({
activities: [{
name: 'game',
ActivityType: 'PLAYING'
}],
status: 'online'
});

console.log('Ready bot');

//commands Slash and register commands slash
});

client.on('interactionCreate', async (interaction) => {
const { commandName, options } = interaction;

// comands slash
});

const prefix = '!';

client.on('message', message =>{
//commands prefix
});
18 replies