devilsbackbone / tdb-backend

The API for The Devils Backbone raid system
MIT License
0 stars 0 forks source link

Discord CTA #14

Open GauteR opened 4 years ago

GauteR commented 4 years ago

Create a Discord CTA with inspirational quotes and how many more we need to do a raid. If we need healers, show other, but highlight the number of healers or something. Pointing it out that we urgently require some more than others.

GauteR commented 4 years ago

Discord requests are done like this:

You send a request to a pre-defined Discord Webhook, sat up in the channel settings on Discord, you attach something similar to the following JSON and send as a HTTP POST:

{ "username": "TDB Bot", "avatar_url": "", "embeds": [{ "color": "16597762", "author": { "name": "TDB Monday Raid" }, "title": "TDB Raid Notification", "url": "https://backbone.mutedchaos.com/raids.php", "description": "Good news, @BwnRaiders ! A raid is up for tonight. Get your ass in gear and come share an adventure with your lovely fellow guildies!", "footer": { "text": "{{CheckTime}}" } }] }

This will show a message in the channel.

Ref. https://discordapp.com/developers/docs/resources/webhook

GauteR commented 4 years ago

Example for a webhook

{
  "username": "Webhook",
  "avatar_url": "https://i.imgur.com/4M34hi2.png",
  "content": "Text message. Up to 2000 characters.",
  "embeds": [
    {
      "author": {
        "name": "Birdie♫",
        "url": "https://www.reddit.com/r/cats/",
        "icon_url": "https://i.imgur.com/R66g1Pe.jpg"
      },
      "title": "Title",
      "url": "https://google.com/",
      "description": "Text message. You can use Markdown here. *Italic* **bold** __underline__ ~~strikeout~~ [hyperlink](https://google.com) `code`",
      "color": 15258703,
      "fields": [
        {
          "name": "Text",
          "value": "More text",
          "inline": true
        },
        {
          "name": "Even more text",
          "value": "Yup",
          "inline": true
        },
        {
          "name": "Use `\"inline\": true` parameter, if you want to display fields in the same line.",
          "value": "okay..."
        },
        {
          "name": "Thanks!",
          "value": "You're welcome :wink:"
        }
      ],
      "thumbnail": {
        "url": "https://upload.wikimedia.org/wikipedia/commons/3/38/4-Nature-Wallpapers-2014-1_ukaavUI.jpg"
      },
      "image": {
        "url": "https://upload.wikimedia.org/wikipedia/commons/5/5a/A_picture_from_China_every_day_108.jpg"
      },
      "footer": {
        "text": "Woah! So cool! :smirk:",
        "icon_url": "https://i.imgur.com/fKL31aD.jpg"
      }
    }
  ]
}

And how it looks

example