Compatibility
Minecraft: Java Edition
Platforms
Supported environments
90% of ad revenue goes to creators
Support creators and Modrinth ad-free with Modrinth+Links
Creators
Details
Server-Side Mod for Player Authentication via Discord.
To apply your Discord bot API token, start the server once with the mod installed. After the initial startup, modify the bot-token field in the generated server-folder/config/lyumix-discord-auth/config.hocon file with your token.
Note: Currently, the mod only supports MongoDB for storing player data. If you don't have a dedicated MongoDB server, you can use a free database from the official MongoDB website.
Steps to Get MongoDB Connection String
-
Sign up or log in to MongoDB Atlas:
- Visit the MongoDB website and sign up for a free account, or log in if you already have one.
-
Create a new cluster:
- Once logged in, go to the Clusters section and click Create Cluster.
- Follow the setup instructions to configure your cluster (e.g., choosing your preferred cloud provider, region, and any free-tier options).
-
Create a MongoDB user:
- Go to the Database Access tab under Security.
- Click Add New Database User.
- Choose a username and password for your database.
- Make sure to select the appropriate role for your user (e.g., Read and Write to any Database).
- Save the username and password for future use.
-
(Optional) Whitelist your server IP address:
- Go to the Network Access tab under Security.
- Click Add IP Address and whitelist your server's IP address, or select Allow Access from Anywhere if you're not sure of the IP or want universal access.
-
Get your connection string:
- Once your cluster is created, click Connect on your cluster dashboard.
- Choose Connect your application.
- Copy the provided connection string. It should look like this:
mongodb+srv://<username>:<password>@cluster0.mongodb.net/?retryWrites=true&w=majority&appName=<app-name>
- Replace
<username>
,<password>
, and<app-name>
with the appropriate values:<username>
: Your MongoDB username.<password>
: Your MongoDB password (URL-encoded if necessary).<app-name>
: The name of your application (optional).
Steps to Create a Discord Bot and Get the API Token
-
Log in to Discord Developer Portal:
- Visit the Discord Developer Portal and log in with your Discord account.
-
Create a new application:
- Once logged in, click the New Application button.
- Give your application a name (this will be the name of your bot) and click Create.
-
Copy your bot's API token:
- In the application's dashboard, navigate to the Bot section on the left-hand menu.
- After setting up the bot, you'll see the bot's information, including the Token.
- Important: You will not be able to see the token again after this point unless you reset it. If you need to access the token, click the Regenerate button next to the token to create a new one, which will reveal the new token.
- Click the Copy button next to the Token field to save it for your mod configuration.
Important: Keep this token secure! If someone else gets access to it, they can control your bot.
-
Invite your bot to a server:
- To add your bot to a server, go to the OAuth2 section in the left-hand menu.
- Under OAuth2 > URL Generator, check the bot box in the Scopes section.
- Scroll down to Bot Permissions and select Send Messages as the only permission your bot needs.
- Copy the generated URL at the bottom, paste it in your browser, and select the server where you want to invite the bot.
User Guide: Minecraft Mod Authentication via Discord
First Login Process
-
Join the Server:
- When you join the server, the bot will automatically send you an auto-generated code in the game chat.
-
Write the Registration Command:
- Go to the specified Discord server (as indicated in the mod configuration).
- In the server chat, type the command:
Replace/register <code>
<code>
with the code you received from the bot in the game.
-
Authorize Direct Messages (DMs) from the Bot:
- Ensure that you have allowed messages from server members or send any message to the bot in a direct message (DM) to initiate communication.
Subsequent Logins
-
Join the Server Again:
- For any future logins, simply join the server as usual.
-
Receive Confirmation Message:
- After joining, the bot will send you a direct message on Discord to confirm your login.
-
Approve or Reject the Login:
- Respond to the bot’s message:
- Type Approve to allow the login and gain access to the game.
- Type Reject to deny access.
- Respond to the bot’s message:
Important Notes
- Keep Your Code Safe: Do not share your auto-generated code or any login details with anyone.
- Allow Direct Messages: Make sure that you have allowed DMs from the bot, or simply send any message to the bot in a DM, for the system to function correctly.