为了账号安全,请及时绑定邮箱和手机立即绑定

如何将普通文本和嵌入在同一条消息中?不和谐.js

如何将普通文本和嵌入在同一条消息中?不和谐.js

BIG阳 2023-03-24 16:01:34
所以我想将嵌入文本和普通文本放在一条消息中。我想我已经看到了,但如果不可能,你可以在评论中说出来。我尝试了一些可能很愚蠢的方法(我是编码新手)。这是我的尝试方式:if (msg.startsWith(among + 'wiki')) { wikipog = message.content.slice(7); var embed = new Discord.MessageEmbed()  .setTitle(':globe_with_meridians: Among Us Wiki :globe_with_meridians:')  .setDescription('Down below is the page you asked for!')  .addField(   'If an image shows up down below, that means your page exists!',   '\u200B'  )  .addField('\u200b', field)  .setColor(color)  .setFooter(footer); message.channel.send(embed, `https://among-us.fandom.com/wiki/${wikipog}`);}先感谢您!(顺便说一下,我知道我可以只执行两个 message.channel.send(),但这会发送两个 ping/通知)
查看完整描述

1 回答

?
莫回无

TA贡献1865条经验 获得超7个赞

TextChannel#send接受 2 个参数。第一个是消息内容(文本),第二个是带有选项的对象。您可以在选项对象中设置嵌入。

const Embed = new Discord.MessageEmbed()

 .setTitle('Title')

 .setDescription('This is an embed message')

 .setColor('RED');


message.channel.send('This is a normal message.', {

 embed: Embed,

});

DiscordJS 13 更新

TextChannel#send接受一个类型的参数string | MessagePayload | MessageOptionsMessageOptions允许您指定内容和嵌入:

const Embed = /* ... */;


message.channel.send({

  content: 'This is a normal message.',

  embeds: [Embed],

});


查看完整回答
反对 回复 2023-03-24
  • 1 回答
  • 0 关注
  • 111 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号