Giving ingame rewards through discord

Was wondering how something like this would be achievable. I have no knowledge of discord bots, honestly just need some resources on how i’d create this. Ive done some research and what ive gathered from it is:

  • Discord sets up an http server
  • The discord command sends a random code to this http server, im guessing it checks existing codes to prevent duplicates.
  • Roblox then uses HttpService to get that list of codes.
  • Reward the player if the code exists.
  • (Maybe delete the code afterward)?

Thats about all I know. Not sure how i’d do things on the discord side, would appreciate some help filling in the blanks here. Is this something thats easily achievable?

This is against the TOS I am pretty sure because it is directing users off of the platform
Even though games do use this I still think its a really bad idea, it’s like don’t speed because everyone else is doing it

This game has over 100M visits and is in the Halloween spotlight. I doubt they’d be allowed to do this if it was against TOS. I also thought it violated TOS but im guessing the policies have changed.

Just because other people are doing it does not mean it is allowed. Even if it is someone big

Would still be nice to learn this skill, do you have any resources that could help?

unrelated to the post but good game already sinked 8hrs into it

1 Like

PolicyService:GetPolicyInfoForPlayerAsync().

2 Likes

I am almost certain that an actual implementation of this is against ROBLOX TOS, so please keep that in mind.

To set something like this up, you would probably need to:

  1. Create a Discord Bot which has commands to give the user a join code.
  2. Create a web server to both issue join codes and receive them from the game.
  3. Create a database to link to the web server to store the issued join code with the Discord and Roblox user id.

So in a practical use case:

When a user runs the /join-code command in the Discord, a web request is sent to the above mentioned web server with the discord user as a parameter. That web server, generates a code and then stores it in a database with the discord user info. The web server then returns the issued code, and the bot serves it to the user.

When the user puts the code into the game, the game sends a web request to the web server along with the code and the Roblox user info. The web server then looks at the database, attempts to find a code, and if it does it will store the Roblox user info with the discord user info. If the Roblox or Discord user has already generated and used a code it will return a negative response. If it hasn’t, and there is a code, the web server will then return a positive response. Then you’d handle logic in-game for rewards & stuff.

A good place to start for a beginner with web servers, is probably Flask (Update: As @Inkthirsty mentioned, fastapi is another great option. Flask is an older, less streamlined, library, however, I would suggest that it gives better learning opportunity) The freeCodeCamp youtube channel has a good tutorial for learning how it works, on the other hand, Flask has a pretty simple syntax so if you’re firmiliar with programming in general it shouldn’t be hard to pick up.

Because this is a non practical use case you could likely get away with just storing the codes and user info in a json file, however, if you’re interested in learning real world use cases I’d recommend learning how to setup a SQL database, and access it with your web server. I’m not in anyway firmiliar with them, unfortunately, so I can’t offer a tutorial. However, google is a wonderful place to start.

Finally, for learning how to make a discord bot there are two common paths. Discord.js and Discord.py. I personally recommend learning Discord.py, especially if you’re also learning Flask as it will be the same language. While I have no experience with discord.js – unlike discord.py – it is also a really common one and also a great starting point. I’d offer a tutorial similar to Flask, but I cannot find a good one. Docs are always a good starting point but there are plenty of tutorials out there. I’d recommend referencing the docs while watching them, however, as they often don’t follow best practices.

I wish you the best of luck on your journey & feel free to reach out if you’d like any help.

2 Likes

flask is garbage use fastapi

1 Like

I’m pretty sure this is allowed, as long as you use

https://create.roblox.com/docs/reference/engine/classes/PolicyService#GetPolicyInfoForPlayerAsync

The only issue I’m wondering if that are we allowed to reward players something if they’re only in the Discord using a bot/checker?

If a staff member can answer to this, that would be very helpful. Thank you!

EDIT: The bot being BloxLink, which is supported by Roblox.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.