Balance slash cmd not working

const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const profileModel = require('../Economy/profiles.js')
module.exports = {
data: new SlashCommandBuilder()
.setName('balance')
.setDescription('View your or another users balance.')
.addUserOption(option1 => option1.setName('user').setDescription('@example').setRequired(true)),
version: "1.0.0",
async execute(interaction, profileData){
const kai = ':Kai:'
const user = interaction.options.getUser('user')
const response = await profileModel.findOne({
userID: user.id
})
const balEmbed = new EmbedBuilder()
.setColor('#0099ff')
.setTitle(`${interaction.member.name}'s Balance.`)
.setDescription('You will find your balance below.')
.setFields([
{name: 'Wallet', value: `${response.kai}${kai}`},
{name: 'Bank', value: `${response.bank}${kai}`},
])
await interaction.reply({ embeds: [balEmbed]})
}
}
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const profileModel = require('../Economy/profiles.js')
module.exports = {
data: new SlashCommandBuilder()
.setName('balance')
.setDescription('View your or another users balance.')
.addUserOption(option1 => option1.setName('user').setDescription('@example').setRequired(true)),
version: "1.0.0",
async execute(interaction, profileData){
const kai = ':Kai:'
const user = interaction.options.getUser('user')
const response = await profileModel.findOne({
userID: user.id
})
const balEmbed = new EmbedBuilder()
.setColor('#0099ff')
.setTitle(`${interaction.member.name}'s Balance.`)
.setDescription('You will find your balance below.')
.setFields([
{name: 'Wallet', value: `${response.kai}${kai}`},
{name: 'Bank', value: `${response.bank}${kai}`},
])
await interaction.reply({ embeds: [balEmbed]})
}
}
No error message shows
8 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
PAdventures
PAdventuresOP3y ago
Node: v16.14.0
Node: v16.14.0
Message is not sending
Message is not sending
d.js docs
d.js docs3y ago
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops. • Once you do, log relevant values and if-conditions • More sophisticated debugging methods are breakpoints and runtime inspections: learn more
PAdventures
PAdventuresOP3y ago
now it suddenly works but interaction.member(or user).name doesnt work replys with undefined
chewie
chewie3y ago
cuz that doesnt exist
PAdventures
PAdventuresOP3y ago
how do i get the users username then
chewie
chewie3y ago
user.username ?
PAdventures
PAdventuresOP3y ago
k 🤦‍♂️
Want results from more Discord servers?
Add your server