我有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.
答案 0 :(得分:1)
首先,您可以使用:
message.author.username
第二,您可以使用此降价:
[description](https://url.here)
[This is an example](https://example.com)