guides:apps:discord

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
guides:apps:discord [2024-06-06 18:18] – add date geekguides:apps:discord [2026-06-05 16:36] (current) – [AutoHoktey v2] geek
Line 17: Line 17:
 http.SetRequestHeader("Content-Type", "application/json") http.SetRequestHeader("Content-Type", "application/json")
 http.Send('{"content": "test"}') http.Send('{"content": "test"}')
 +</code>
 +
 +Send an embed (requires a JSON library):
 +<code AutoHotkey>
 +#Include <JSON>
 +
 +http := ComObject("WinHttp.WinHttpRequest.5.1")
 +http.Open("POST", "https://discord.com/api/webhooks/...")
 +http.SetRequestHeader("Content-Type", "application/json")
 +http.Send(JSON.Dump({
 +    embeds: [{
 +        title: "Some Title",
 +        description: "Some Text",
 +        color: 0xFF00FF,
 +        fields: [
 +            {
 +                name: "Field 1",
 +                value: "Vaule 1",
 +                inline: true
 +            },
 +            {
 +                name: "Field 2",
 +                value: "Value 2",
 +                inline: false
 +            }
 +        ],
 +        footer: {
 +          text: "Footer Text"
 +        }
 +    }]
 +}))
 </code> </code>