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

MessagingService API

Did you select the right permissions when making the api key? But I meant printing the entire response object, not just response.status.


Something else

There is a reason why there is a minimum for … characters. You should make every post you post as extensive as you can. So that we don’t have to make 1000 posts lol.

are you sure you are using roblox studio api key?


I mean all I can mostly understand is the “Unauthorized” part.

¯_(ツ)_/¯

Yes I am, unless I set it up incorrectly perhaps.

Otherwise you could’ve pasted it in wrong maybe. Or maybe you’re using the wrong universe id?

That’s the key settings:

And checking the universe ID it’s the same and correct.
(I used this. just so you know fully)
image

Should be all good yeah?
If it is something to do with the key, it’s most likely the IPs.

There’s the roblox script aswell:
image

then the problem could be with fetch aka headers

Maybe perhaps this could help? I don’t seem to understand this but you guys might:

Either you aren’t sending json to roblox or roblox isn’t sending json back.

Could you print JSON.stringify() and print response.text() (it’s an async function so you need .then() again)


I think the issue is because of this, maybe remove the ips?

Printed both, here’s the results:

  1. JSON.stringify({id: "goofball"}) and 2) response.text()
    image

As for the IPs, cannot remove them. There has to be at least one.

???


What ips did you add? Of your computer and your discord bot’s computer?

Sorry, can you write a short example? As mentioned, pretty new to node.js

Wasn’t thinking much when adding those IPs so I added the example IP (no idea why) and mine through searching “whats my ip”. But I’m guessing most likely I have to use some different IP.

1 Like

hello my fellow friend are you using repl it?

Yeah. I really don’t know any other hosting platform to use. But I like it too so yeah.

well thats the problem because of roblox “alts” fix where they made cookie login not work if you use other ip
and for this api you need to have edit access for the game
image

I see. So what could I use to make this work?

Every async function returns a promise. So you need to do something special to actually get the result of the promise, when it finishes.

You either have to await it

await asyncFunction()

but this can only be done inside of async functions, so you have to

asyncFunction().then(resultOfTheFunction => {
    // do stuff here
})

just like with fetch().

Full example:

// your fetch
.then(response => response.text())
.then(text => console.log(text))

Yes the IP of the device that is sending the requests. I don’t know how you would do this with repl it (because I doubt they give you one fixed ip). Maybe using the
image
subnet CIDR rotation thing.

there’s not really anything that you could use to make it work on repl it because it resets your cookie each time you try to log-in into account with it

But im not sure if this api needs authorization

Bingo. Means it has something to do with the API key, am I right?
image