#My embed doenst work #embeds

14 messages · Page 1 of 1 (latest)

muted crown
#

my embeds dont send, but messages usually do. I tried to change the code and looked for help with gpt but emebed still doesnt work /:

const fs = require('fs');

const client = new Discord.Client({ intents: [
    Discord.GatewayIntentBits.Guilds,
    Discord.GatewayIntentBits.GuildMessages,
    Discord.GatewayIntentBits.MessageContent
]});

client.commands = new Discord.Collection();

const commandfolders = fs.readdirSync('./commands');

for (const folder of commandfolders) {
  const commandFiles = fs.readdirSync(`./commands/${folder}`).filter(file => file.endsWith('js'));

  for (const file of commandFiles) {
    const command = require(`./commands/${folder}/${file}`);
    client.commands.set(command.name, command);
  }
}

const prefix = '!';

client.once('ready', () => {
  console.log(`Logged in as ${client.user.tag} (bot is online)`);
  client.user.setActivity('wacuus', { type: 'WATCHING' });
});

client.on('messageCreate', async message => {
  console.log(`Message received: ${message.content}`); // Logging the message

  if (!message.content.startsWith(prefix) || message.author.bot) return;

  const args = message.content.slice(prefix.length).trim().split(/ +/);
  const commandName = args.shift().toLowerCase();

  console.log(`Command detected: ${commandName}`); // Logging the command name

  if (!client.commands.has(commandName)) {
    console.log(`Command not found: ${commandName}`); // If the command doesn't exist
    return;
  }

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

  try {
    command.execute(message, args);
  } catch (error) {
    console.error(error);
    message.reply('Oops... Something went wrong, and your command could not be executed.');
  }

  console.log('Loaded commands:');
  client.commands.forEach((command, name) => {
    console.log(`- ${name}`);
  });
});

client.login('YOUR_BOT_TOKEN');

Version: v22.12.0

tepid shoalBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
muted crown
#

Embed file:


module.exports = {
  name: 'embed_regulamin',
  description: "Regulamin Serwera",
  usage: '!embed',
  execute: async (message, args) => {
    const embed_regulamin = new EmbedBuilder()
      .setTitle('Regulamin serwera svcut.pl')
      .setDescription('Przykładowy regulamin')
      .setColor(0x00AE86);

    message.channel.send({ embeds: [embed_regulamin] });
  },
};
hallow isle
#

What happens when you try to send an embed? Do you get an error in the terminal?

undone pasture
#

also what is your djs version

#

because some of that code is outdated

#

which chatgpt and ai tend to do so dont use ai

hallow isle
#

Please update to v14

#

We do not offer support for older versions, including v12

muted crown
#

i have just installed to v14 and restared pc, and im tottally new in discord.js so imsry

azure joltBOT
undone pasture
#

follow the guide

#

not some ai