Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Carpet Discarpet Wiki › Guides › Set Up a Discord Bot to Read Minecraft Chat

Set Up a Discord Bot to Read Minecraft Chat

Prerequisites

You'll need a Discord bot token from the Discord Developer Portal and the Carpet Discarpet Mod installed alongside Carpet. Have both mods loaded on your server.

Creating the Bot Connection

Use Scarpet to initialize a Discord bot connection by calling the appropriate Discord API function with your bot token. This establishes the link between your Minecraft server and Discord.

Once connected, write a Scarpet script that listens to Minecraft chat events. When a player sends a message in-game, your script can capture it and relay it to a Discord channel using the Discord message-sending function.

Testing the Setup

Start your server and send a test message in Minecraft chat. Check your Discord channel to confirm the message appeared. If nothing shows up, verify your bot token is correct and that the bot has permissions to send messages in your target channel.

You can expand this by filtering messages, adding player names as prefixes, or only forwarding specific chat types. Adjust your Scarpet script to customize what gets sent to Discord.