Hello.
I was coding a balance command for my bot, and it works well. But I want it to show the balance of other user, but without ping it.
Example:
s!balance
BOT: has X moons.
Anyway to do this?
Hello.
I was coding a balance command for my bot, and it works well. But I want it to show the balance of other user, but without ping it.
Example:
s!balance
BOT: has X moons.
Anyway to do this?
Still not finding what Iâm looking for. That only can be used when you know the username. The thing is: How the hell I can make what I showed in the exampleâ
are you trying to get your own balance? i donât understand your goal
Getting my balance is easy. Iâve already dons that. But what I want to do is get another userâs balance.
get the mention/id/username from the arguments of the command and use that to fetch the user object. from there get the balance as normal
OK⊠But Iâm getting some problems, cause I want to use it with mention, id and username only.
How can I do that?
can i see the code you are using right now?
const db = require(âquick.dbâ)
const Discord = require(âdiscord.jsâ)exports.run = async(bot, message, args) => {
let usermon = message.mentions.members.first();let usermoons = await db.fetch(
moons_${message.author.id}
)if(!usermon){
message.channel.send(<a:economia:580518832792272916> **|** > ${message.author.username}, vocĂȘ possui **${usermoons}** moons.
)} else {
let membermoons = await db.fetch(`moons_${usermon.id}`) let membubebed = new Discord.RichEmbed() .setAuthor(usermon.displayName) .setThumbnail(usermon.user.avatarURL) .setColor("RANDOM") .addField(`<:certo:580518832611786753> Possui`, `${membermoons} moons`) message.channel.send(membubebed)
}
}module.exports.command = {
name: âmoonsâ,
description: âNumero de moons que vocĂȘ temâ,
category: âeconomiaâ,
usage: âmoonsâ,
enabled: true
}
Sorry for the delay. If you change let usermon = message.mentions.members.first();
to let usermon = message.mentions.members.first() || message.guild.members.get(args[0]);
it will work with both user idâs and mentioning a user. Adding username into the mix would add several lines of code in my experience and is not reliable anyway because people can change usernames whenever
Thanks man! It worked!