Discord Integration: A guide on using Discord through Roblox [UPDATED]

There is a discord webhook API in the models made by Tigerism that works really well. I don’t think it supports embeds or anything of sort, just messages. Good tutorial though, good luck expanding it.

EDIT: Direct requests to Discord from Roblox no longer work, so I am going to assume that this API isn’t functional.

36 Likes

Also good to mention that you should wrap the PostAsync in a pcall function because it will fail from time to time.

14 Likes

This is actually against Discord’s TOS. I’d definitely advise against it.

58 Likes

That’s strange. Why would they block an error monitor?

9 Likes

Maybe it’s too resource intensive depending on the amount of errors

16 Likes

I actually replied & asked if it was b/c of resources, but he just responded with this:

My best guess would be that they allow webhooks for stuff meant for Discord (like bots), and not people using it to send stuff.

23 Likes

That makes sense I guess. I’ll remove the error monitoring part.

7 Likes

You can leave it up there since it’d still help people out, but I had one logging errors for Survivor (which got 29k players at once), so I’m assuming the high amount of http requests made them look into what it was for. As long as your game doesn’t have a lot of players at once, they probably won’t ever check it.

7 Likes

Can definitely agree with @repotted that lower traffic is probably fine. My game had 3k players on at once sending reports without any problems.

7 Likes

Yeah, that’s probably why :grimacing:. I’ll put it back up there with a warning so people don’t get their discords terminated.

11 Likes

I talked to a few of the Discord developers about this and it would seem that the main issue was certain developers not being meticulous about how many requests they were sending. For example, if you have an error that triggers multiple times per second because of some unchecked bug, you would basically be DDoSing Discord with POST requests. I’d say they likely mitigate this by checking certain headers that were present in the request that would reveal it was sent from a ROBLOX server.

There are several very high-profile servers that actively use Discord to log important errors, so I’m going to guess they aren’t completely opposed to error logging on the platform but ban it in the case of ROBLOX due to the very high potential of API abuse.

Then again, some people are still sending webhook messages through ROBLOX; perhaps this is because they’re only going after people causing trouble or they have a certain check setup like “if sent from ROBLOX and channel name includes ‘error’…”

TLDR: Use Sentry, it’s awesome and actually made for error logging.

19 Likes

Please do not spam discord. If too many people do this they may just blacklist roblox server IPs in general and that would ruin it for everyone who doesn’t abuse it.

25 Likes

Would it be better to just remove the monitor in general? Some people with malicious intent might be viewing this.

4 Likes

It’s kind of unavoidable. Worst case scenario those who use it responsibly can set up a proxy for very cheap (cheap because they aren’t overloading it!!)

4 Likes

Alright. Thanks for the feedback all of you by the way.

5 Likes

I haven’t used webhooks in a while, but I think you can send multiple embeds in one HTTP request. You could group several messages (each as a separate embed) into one request.

Actually lemme test:

{
  const url = 'https://canary.discordapp.com/api/webhooks/343362987622662144/z6r8217KiNVhWxf3SbnOaX8fQ4__TptWNvApVM3VqgybOXdQOE5-sgy00D4nMio7g89-';

  function embed(title, desc, color, author) {
    return {
      timestamp: "2017-07-11T17:27:07.299000+00:00",
      title,
      desc,
      color,
      author: {
        name: author,
        icon_url: 'https://cdn.discordapp.com/emojis/339896242211389450.png'
      },
      fields: [
        {
          name: 'A',
          value: 'B',
          inline: true
      },
        {
          name: 'A',
          value: 'B',
          inline: true
      },
        {
          name: 'A',
          value: 'B',
          inline: true
      },
        {
          name: 'A',
          value: 'B',
          inline: true
      },
    ]
    }
  }

  console.log(embed('a', 'b', 0xFFFFFF, 'einsteinK'));

  $.post(url, JSON.stringify({
    embeds: [
    embed('Title1', 'Description1', 0xFF0000, 'einsteinK'),
    embed('Title2', 'Description2', 0x00FF00, 'einsteinK'),
    embed('Title3', 'Description3', 0x0000FF, 'einsteinK'),
  ]
  }), console.log);
}

I already deleted the webhook to prevent spam. thanks to antonio6643#8700 for pointing that out

16 Likes

We actually attempted to do that with the egg hunt this year and did not get such a message. We hit like all rate limits though so we had to remove it after a few hours.

4 Likes

Honestly depends on what you’re using it for, and if your game is constantly printing things in the console.

2 Likes

:pray: A user some months back linked me to Tigerism’s stuff, tons of coolness. This tutorial will hopefully spread the neat usage of Discord integration in ROBLOX.

3 Likes

Have you integrated Sentry with Roblox? If so, could you make a tutorial on that maybe?

4 Likes