【问题标题】:Discord.js embed say commandDiscord.js 嵌入 say 命令
【发布时间】:2021-11-07 13:37:24
【问题描述】:

我正在尝试编写一个命令,所以当有人说 !embed 时,它会向他们的频道发送一个嵌入,其中包含他们在消息中输入的标题、描述和颜色,有人可以帮助我吗?

【问题讨论】:

  • 到目前为止你能发布你的代码吗?
  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: discord discord.js repl.it


【解决方案1】:
//the message must be like (!embed Title-<> Color-<> Description)
//!embed Title-<test one> Color-<#ffffff> test test test test test

let title = message.content.split("Title-<")[1].split(">")[0];
let color = message.content.split("Color-<")[1].split(">")[0];

let description = message.content
      .replace("!embed","")
      .replace(`Title-<${title}>`,"")
      .replace(`Color-<${color}>`,"")

let embed = new Discord.MessageEmbed()
      .setTitle(title)
      .setDescription(description)
      .setColor(color)

message.channel.send(embed)

好吧,我英语不好
但如果答案不起作用,请告诉我修改它
it will work like this

【讨论】:

    猜你喜欢
    • 2020-07-14
    • 2021-04-24
    • 2019-08-21
    • 2020-10-09
    • 1970-01-01
    • 2020-10-18
    • 2023-03-12
    • 2021-07-10
    • 2023-04-03
    相关资源
    最近更新 更多