I have a command in which one user virtually kisses another
The output is a message @User1 kissed @User2
But I want that instead of tags on the user, only names were written, like this so that it was user1 kissed user2
In theory, everything should work like this
`**${message.author.username}** kissed **${userToKiss.username}**`
But if the name for message.author is defined, then there is none for userToKiss and I end up with this
user1 kissed undefined
How can I get the name for the second user?
const { Command } = require('discord.js-commando');
const Discord = require('discord.js');
module.exports = class KissCommand extends Command {
constructor(client) {
super(client, {
name: 'kiss',
memberName: 'kiss',
group: 'reywl',
description: 'Kiss the mentioned user',
guildOnly: true,
args: [
{
key: 'userToKiss',
prompt: 'Please select the member you want to kiss.',
type: 'member',
default: 'isempty',
wait: 0.0001
}
]
});
}
run(message, { userToKiss }) {
if (userToKiss == 'isempty') {
return message.channel.send('Please select the member you want to kiss.')}
if (userToKiss.id == message.author.id) {
return message.channel.send('You cant kiss yourself!');
}
else {
const embed = new Discord.MessageEmbed()
.setDescription(`**${message.author}** kissed **${userToKiss}**`)
message.channel.send(embed)
}
setTimeout(() => message.delete(), 1000)
}};
For deep explanation for your work, to do this you need to code first about the member, we always do about
memberandauthorAuthor is for the author itself and the member for your members who are you going to call
I don't know if
commandoand normal command handlers are the same but here's the code what you wanted.for the author you can only do this
You can also ping a member using their Id's
So the main output is