#console shows promise pending

13 messages · Page 1 of 1 (latest)

mortal mango
#

module.exports = {
    data: new SlashCommandBuilder()
        .setName('staffmember')
        .setDescription('tee')
        .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
        .setDMPermission(false),
    async execute(interaction) {
    const tagName = interaction.guild.roles.fetch('1224381394428498063')
    .then(role => role.members)
    .catch(console.error);
    await console.log(tagName);
    const tagDescription = interaction.user;

    try {
    // equivalent to: INSERT INTO tags (name, description, username) values (?, ?, ?);
      const tag = await interaction.client.Tags.create({
        name: '1',
        description: '1',
        username: interaction.user.id,
      });
      return interaction.reply(`Tag ${tag.name} added.`);
    }
    catch (error) {
      if (error.name === 'SequelizeUniqueConstraintError') {
        return interaction.reply('That tag already exists.');
      }
    console.log(error)
    return interaction.reply('Something went wrong with adding a tag.');
  }},
};```
north drumBOT
#
  • 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
obtuse jasper
#

well... await the promise

mortal mango
#

i know where is the mistake

hard panther
mortal mango
#

but await can't handle it

mortal mango
hard panther
#

no that's not what i meant

#

you're not awaiting .guild.roles.fetch

mortal mango
#

oh thx

#

so await could add behind =

#

i only know it could typed in beginning