node.js-duscird.js获取相关用户的名称
发布时间:2022-04-07 17:51:58 485
相关标签: # java
我有一个命令,其中一个用户实际上亲吻了另一个用户
输出是一条消息@User1 kissed @User2
但是我想让用户只写名字,而不是标签,就像这样user1 kissed user2
理论上,一切都应该是这样
`**${message.author.username}** kissed **${userToKiss.username}**`
但是如果message.author
定义了,那么就没有了userToKiss
我最终得到了这个
user1 kissed undefined
如何获取第二个用户的名称?
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)
}};
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报