【问题标题】:POST Discord Message EmbedPOST Discord 消息嵌入
【发布时间】:2018-12-04 10:33:57
【问题描述】:

这是我使用发送 JSON 正文数据的方式。

{

"reactions": [

{

"count": 1,

"me": false,

"emoji": {

"id": null,

"name": "????"

}

}

],

"attachments": [],

"tts": false,

"embeds": [],

"timestamp": "2017-07-11T17:27:07.299000+00:00",

"mention_everyone": false,

"id": "334385199974967042",

"pinned": false,

"edited_timestamp": null,

"author": {

"username": "Mason",

"discriminator": "9999",

"id": "53908099506183680",

"avatar": "a_bab14f271d565501444b2ca3be944b25"

},

"mention_roles": [],

"content": "Supa Hot",

"channel_id": "290926798999357250",

"mentions": [],

"type": 0

}

我只收到下面的图片。我没有收到任何嵌入消息或仅在“内容”所在的位置获得的任何内容。

所以理论上你需要 JSON 正文数据来嵌入消息,我正在使用一个发送 POST 和 GET 请求的程序。 Discord 只会获取“内容”数据并将其发布到我的 webhook 频道中。我需要使用 JSON 数据嵌入消息。这里没有语言,只有 JSON 数据,它是一个程序,你输入变量和数据然后它会发送它。所以我没有使用 java 脚本或任何东西。

What It Sends Via Webhook

【问题讨论】:

    标签: javascript arrays post get discord


    【解决方案1】:

    您的负载中有大量数据无法被 Discord Webhook 识别。允许的主要标签是 username、avatar_url、content、embeds、tts、file。因此,纯文本可以转到 content,在您的情况下,这已经成功。所有更花哨的东西都需要在 embeds 的子内容中。

    到目前为止我找到的最好的参考是this one

    我还建议在 this tool 中预览您的 JSON 代码。

    如此简化为您的示例中的有效方法,仅此而已:

    {
      "username": "Mason",
      "avatar_url": "http://your.domain.here/a_bab14f271d565501444b2ca3be944b25",
      "content": "Supa Hot",
      "tts": false
    }
    

    【讨论】:

      猜你喜欢
      • 2021-08-12
      • 2021-08-02
      • 1970-01-01
      • 2021-07-07
      • 1970-01-01
      • 1970-01-01
      • 2021-12-21
      • 2021-10-16
      • 2021-06-16
      相关资源
      最近更新 更多