console shows promise pending

const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');

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.');
}},
};
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');

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.');
}},
};
7 Replies
d.js toolkit
d.js toolkit9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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
Svitkona
Svitkona9mo ago
well... await the promise
Unicorn.
Unicorn.OP9mo ago
i know where is the mistake
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
Unicorn.
Unicorn.OP9mo ago
i just want console log the array of members but await can't handle it in my guild
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
Unicorn.
Unicorn.OP9mo ago
oh thx so await could add behind = i only know it could typed in beginning i need to gain more javascript skills
Want results from more Discord servers?
Add your server