如何解决阿凡达和Ping命令,帮帮我吗? :D
我有2个无法解决的“问题”:
首先:
这是我的代码:
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "ping",aliases: ["ping"],description: "Show Bot Ping.",execute(message) {
message.delete().catch(O_o => {});
let commands = message.client.commands.array();
let helpEmbed = new MessageEmbed()
.setTitle("API latency: ")
.setDescription(`**${Math.floor(message.client.ws.ping)} ms!**`)
.setColor("#fffff1")
.setFooter(`Command requested by: ${message.author.tag}`);
return message.channel.send(helpEmbed).catch(console.error);
}
};
当我使用ping命令时,一切都会正常进行...
https://cdn.discordapp.com/attachments/744902402964062262/746774318813413436/API.png
我想要的是,在最后一部分Command requested by: ColorlessWorld # 9293
中,我希望它仅显示用户名,即Command requested by: ColorlessWorld
但是我不知道该怎么做。
第二: 这是我的代码:
const Discord = require('discord.js');
module.exports = {
name: 'avatar',description: 'returns a users avatar',execute(message,args){
message.delete().catch(O_o => {});
const { prefix,token } = require ('../config.json');
const embed = new Discord.MessageEmbed()
if(!message.mentions.users.first()){
embed.setDescription(`
**:camera_with_flash:Avatar**
Use !avatar @NickName.`)
embed.setColor('fffff1')
return message.channel.send(embed)
}else{
const user = message.mentions.users.first()
embed.setImage(user.avatarURL({ format: 'png',dynamic: false,size: 256 }))
embed.setDescription(`**:camera_with_flash:@${user.username}**
Click [here] to download.`)
embed.setColor('fffff1')
embed.setFooter(`Command by: ${user.username}`,message.author.displayAvatarURL({format: "png"}))
return message.channel.send(embed)
}
}
}
如何在[这里]保持蓝色?像几个著名的机器人?
Click [here] to download.
解决方法
首先,您可以使用:
message.author.username
第二,您可以使用此降价:
[description](https://url.here)
[This is an example](https://example.com)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。