How would I go about making a Discord-Roblox bot?

Hey everyone.
I want to make a Discord-Roblox bot that when you message something in a Discord server. The bot picks it up and fires and event in-game. I know there’s something named noblox-js but it only does website stuff, like ranking people in groups, etc (I think).

ALSO
I am NOT asking for a webhook system. Just to make sure again.

I tried looking around the devforums for a while but didn’t find much.
Any help is much appreciated!

5 Likes

I dont think Discord is Allowed on Roblox with Default HttpService. So you may need to find a workaround for that

Hmm… I don’t know, I don’t think Roblox allows you to send an API request to a server, though not sure. Maybe you can make an API, and put a script in ServerScriptStorage that sends requests to that API every second(or a couple) to see if there’s anything new.

3 Likes

Hi @ApparentlyJames,

Just answered a topic similar to this some time ago, check this: How can i send value from roblox to discord bot - #3 by Sonostrano20

1 Like

Using the messaging service cloud api you can make MessagingService messages using http requests from something like a discord bot. Then in roblox you can listen to these.

1 Like

It looks like it might work but I’m completely new to this. So I need something that would be dummy simple. Yk?

Mind giving an example of how I should do that?

In Roblox

game:GetService("MessagingService"):SubscribeAsync(topic, function(message)
	print(message.Data)
end)

In your discord bot (might be slightly wrong, I don’t know what APIs are available in a discord bot)

fetch('https://apis.roblox.com/messaging-service/v1/universes/{universeId}/topics/{topic}', {
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify( { "id": 78912 } )
})
.then(response => {
    response.status // check whether it is 401 or something
})

If I may ask, what’s the id for?
May ask basic looking questions since I’m sort of new to js

This is just example data, I looked up “js post request” lol.
It should appear inside of message.Data in Roblox.

Ah I see.

\\\\\\\\\\\\\\\\\\\

Looking at the messaging service cloud api documentation you should add

'x-api-key': 'your cloud api key thing from roblox'

to the headers. And also I think the Accept header isn’t necessary.

noted
\\\\\\\\\\\\

So this should work yes?

Because as of now nothing seems to be happening

It should work, maybe see what happens by printing response?

Also what is your code in roblox?

Same one, hasn’t changed yet
\\\\\\\\\\\\\

Also, it printed out “401”. Not sure what to do with that

you can just listen for website like in one server make it servers handlers and make it getasync of website each second if it finds anything it will use message service to send request to other servers

what scripting language are you using python?

node.js
\\\\\\\\\\\\\\\\