我正在编写一个小小的机器人项目,为了挑战我自己,我决定做一个新的命令。命令应该做一个嵌入,在这个嵌入中,同时提到目标用户和使用命令的人,嵌入一个简短的视频。
module.exports = {
name: "bonk",
description: "bonks someone",
category: "funsies",
command: true,
execute(message, args, Discord) {
const bonkEmbed = new Discord.MessageEmbed()
.setColor("#cc4371")
.setTitle("<@user> BONKED <@target user>")
.setDescription("[somethin, idfk]")
.setThumbnail("https://discord.com/channels/774446440252309524/881660577351630849/887115025775476747")
.addFields({ name: "you got bonked!", value: "https://discord.com/channels/774446440252309524/881660577351630849/887110690719010847" }),
.setTimestamp()
.setFooter('~~lmao~~');
message.channel.send(bonkEmbed);
}
}; module.exports = {
name: 'impostor',
description: 'Calls someone an impostor.',
category: 'funsies',
command: true,
execute(message, args) {
const user = message.mentions.users.first() || message.author;
var receiver = "<@!" + user + ">";
message.channel.send(receiver + " was the impostor", {
files: ['https://media.discordapp.net/attachments/716942890089316383/755907669453438996/among_us_lmao.png?width=356&height=475']
});
},
};由于我对javascript缺乏经验,我将这两种代码中的后一种作为前者的一种脚手架。我使用了一种已经存在的嵌入格式,但这给我的命令提示符带来了问题。它不希望某些标记是这个命令工作所必需的,我甚至不知道如何修复它们。
发布于 2021-09-14 09:45:28
遗憾的是,你不能添加视频,gifs嵌入。此外,您不能添加提及嵌入的标题。它们只是不工作,所以这将不能正确显示:
.setTitle("<@user> BONKED <@target user>")您让我猜测.setDescription()部分的“占位符”,我强烈建议您将其用作“标题”
.setDescription("<@user> BONKED <@target user>")当然,<@user>和<@target user>不会显示任何可提及的内容,但我想这也只是一个占位符。
发布于 2021-09-14 12:07:23
您可以添加提及以嵌入标题,请尝试使用描述中的提及。
不过,它不会提到用户,就像一条短信.
此外,您正在设置一个消息链接作为您的缩略图和字段!
https://stackoverflow.com/questions/69170719
复制相似问题