! MYA
! MYA
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
javascript object misbehaving
ok
16 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
javascript object misbehaving
Oh sorry. Should I close this and open a new post in https://discord.com/channels/222078108977594368/1081585952654360687?
16 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
javascript object misbehaving
100 (Number)
16 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
javascript object misbehaving
No description
16 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
javascript object misbehaving
yes
16 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
javascript object misbehaving
I initially thought it was a problem with the data type that I was passing through to the embed
16 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
javascript object misbehaving
No description
16 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
javascript object misbehaving
heres the embed that it returns
16 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
javascript object misbehaving
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
const UserCurrencyProfile = require("../../models/userCurrencyProfile");

module.exports = {
data: new SlashCommandBuilder()
.setName("balance")
.setDescription("Check a balance")
.addUserOption(option => option.setName("user").setDescription("user you want to check the balance of.").setRequired(false)),

/**
* @typedef {Object} RunOptions
* @property {import("discord.js").Interaction} interaction
*/

/**
*
* @param {RunOptions} options
* @returns
*/


run: async ({ interaction }) => {
try {
const userIdToSearch = (interaction.options.getUser("user") || interaction.user).id
const userObject = await UserCurrencyProfile.findOne({ "userid": userIdToSearch })

console.log(userObject)

const walletValue = toString(userObject["wallet"])
const bankValue = toString(userObject["bank"])

console.log(walletValue)

const balanceEmbed = new EmbedBuilder()
.setTitle("Balance")
.setDescription("Shows the balance of the user")
.addFields(
{name: "wallet", value: walletValue},
{name: "bank", value: bankValue}
)
.setColor("Green")
await interaction.reply({embeds: [balanceEmbed]})
} catch (error) {
console.log(error)
}


}


}
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
const UserCurrencyProfile = require("../../models/userCurrencyProfile");

module.exports = {
data: new SlashCommandBuilder()
.setName("balance")
.setDescription("Check a balance")
.addUserOption(option => option.setName("user").setDescription("user you want to check the balance of.").setRequired(false)),

/**
* @typedef {Object} RunOptions
* @property {import("discord.js").Interaction} interaction
*/

/**
*
* @param {RunOptions} options
* @returns
*/


run: async ({ interaction }) => {
try {
const userIdToSearch = (interaction.options.getUser("user") || interaction.user).id
const userObject = await UserCurrencyProfile.findOne({ "userid": userIdToSearch })

console.log(userObject)

const walletValue = toString(userObject["wallet"])
const bankValue = toString(userObject["bank"])

console.log(walletValue)

const balanceEmbed = new EmbedBuilder()
.setTitle("Balance")
.setDescription("Shows the balance of the user")
.addFields(
{name: "wallet", value: walletValue},
{name: "bank", value: bankValue}
)
.setColor("Green")
await interaction.reply({embeds: [balanceEmbed]})
} catch (error) {
console.log(error)
}


}


}
16 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
javascript object misbehaving
Heres my src
16 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
An error I do not understand
ty
11 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
An error I do not understand
Ohh ok
11 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
An error I do not understand
Its the first time iv seen an error like this before!
11 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
An error I do not understand
CombinedPropertyError (2)
Received one or more errors

input[0]
| CombinedPropertyError (1)
| Received one or more errors
|
| input.value
| | ValidationError > s.string
| | Expected a string primitive
| |
| | Received:
| | | 100

input[1]
| CombinedPropertyError (1)
| Received one or more errors
|
| input.value
| | ValidationError > s.string
| | Expected a string primitive
| |
| | Received:
| | | 0
CombinedPropertyError (2)
Received one or more errors

input[0]
| CombinedPropertyError (1)
| Received one or more errors
|
| input.value
| | ValidationError > s.string
| | Expected a string primitive
| |
| | Received:
| | | 100

input[1]
| CombinedPropertyError (1)
| Received one or more errors
|
| input.value
| | ValidationError > s.string
| | Expected a string primitive
| |
| | Received:
| | | 0
11 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
An error I do not understand
and the error is`
11 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
An error I do not understand
11 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/18/2024 in #djs-questions
An error I do not understand
hres the src code
11 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/9/2024 in #djs-questions
slash commands not working
:SkullCry_DV:
32 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/9/2024 in #djs-questions
slash commands not working
I gotta re write this whole thing
32 replies
DIAdiscord.js - Imagine an app
Created by ! MYA on 8/9/2024 in #djs-questions
slash commands not working
Yeah bro im cooked
32 replies