Create a Minecraft Discord bot!
![]()
In this guide we will create a Minecraft bot named Stevey that will give us some control over our server.
Index:
- Configuring Our Minecraft Server settings.
- Creating the Discord Bot.
- Creating our Minecraft commands.
1. Configuring our Minecraft server settings:
Here we assume you already have a Minecraft server up and running and we will be showing you the required settings to allow our bot to communicate with the server.
On your server find and open your server.properties config file. This file contains the fields we need to edit and take note of to allow our bot to communicate with our server. Enabling some of these fields and assigning a password will allow us to use RCON and QUERY with our server.
Once you have all your Ports, IP and enabled the required fields. Save your configurations and restart the server. Fill the following fields in your .env file for our bot to access our Minecraft server.
Save your .env file and now let’s setup our Discord bot.
2. Creating the Discord bot:
We will be building a bot from scratch, but if you have an existing bot, you are more than welcome to use that file.
Run the following commands to get started:
— touch bot.py .env
— pip install discord.py python-dotenv mcron mcstatus
In your .env file add a new variable like follow:
In your bot.py file paste the following code:
What we did is create our own discord bot class and named it Stevey . Here we add the token variable to be accessed when start_bot() gets called and to make sure our bot connects successfully we added an event called on_ready() which will print to our terminal with our bot’s name and that it has successfully connected to Discord.
Not let’s test it out and you should see the following in your terminal:
“There comes a point in your bot’s development when you want to organize a collection of commands, listeners, and some state into one class. Cogs allow you to do just that. The gist: Each cog is a Python class that subclasses commands.”
To keep all our commands, listeners and state in one class we need to create what is called a Cog. Each cog is a Python class that subclasses commands and is useful for keeping things organized as your bot has more commands. So the next step we need is to create a Cog for our bot to manage our Minecraft specific commands.
Run the following commands in your terminal to create the following directory and files
In our minecraft.py file paste the following:
In our bot.py edit the file to add our new Cog:
We now added a new command to our bot called test this will allow us to test that our bot can get our messages from discord and relay them back to us. Run the bot with python bot.py and go to your discord server where your bot has been invited to. Send a message to our bot in one of the channels with the following s:test "Hello Stevey!” and you should get a reply from the bot saying you send me: Hello Stevey! .
Now that we know our bot can receive commands and send them back let’s give it a Minecraft specific functionality.
3. Creating our Minecraft commands:
Now that we can communicate with our bot we want to be able to give our bot some useful Minecraft skills. We also want to limit our bot from being spammed so for now let’s make it so that only us the admins can run bot commands.
Let’s start by adding some permission check so only you can send your bot the msg command assuming you are admin on your server. Open minecraft.py and add the following to your file:
We edit our Minecraft class to add our ports, host and password fields. We also add a new status() method that allows us to query our server status using the mcstatus library. Response allows us to see number of Players that are online and the latency. Note how we added a permission check to only allow admins to use this command. This is optional.
Now let’s add a new command that gives us a messaging ability. Open minecraft.py and edit the file to add the following lines:
Now using the mcron library we take advantage of enabling the rcon feature on our server which allows us to send commands. With the msg() method we allow admin to send a message to everyone on the server or a specific Minecraft player that is online using built-in Minecraft commands.
Conclusions:
Now that you have a Minecraft Discord bot you can create more commands that allow you to manage and maintain your server. For example restarting the server from Discord and kicking players off that aren’t following rules 🙂
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
The Minecraft Discord Sync Plugin allows you to Sync your Minecraft and discord Server. Synchronize Minecraft and Discord Ranks and Ingame <-> Discord Chat
License
VironLab/MinecraftDiscordSync
Name already in use
- Local
- Codespaces
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more about the CLI.
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
The Minecraft Discord Sync Plugin allows you to Sync your Minecraft and discord Server.
Synchronize Minecraft and Discord Ranks and Ingame <-> Discord Chat
- Bukkit Based Servers:
-
API: 1.15 ++ API: 1.15 ++
- Default Supported Permission Plugins:
- Nukkit Based Servers:
-
API: 1.0.9 ++
- Default Supported Permission Plugins:
- IngameCommands:
- verify ( PERM: mcdcs.command.verify ) — Sends you an code to verify at the discord server
- discord ( PERM: mcdcs.command.discord ) — send the discord invitelink
- discordinfo/dcinfo ( PERM: mcdcs.command.discordinfo ) — shows some informations about the connected discordserver
- verify (verificationcode) — Verifies the user by the ingame given verification code ( IngameCommand verify )
- about — prints plugin and author infos
- online — shows the online players at the server
- playerlist — shows the online player list
- serverinfo — shows some general minecraft server infos of the connected minecraft server
- Custom Activity ( GameStatus / OnlineStatus )
- Custom OnlineCounter Channel — displays every minute the live online count of the minecraftserver
Default Storage Providers
- YAML ( config file in plugin datafolder )
- MongoDB ( stores data in a database — its a nice feature if the plugin is running on multiple servers to sync verifications )
The plugin provides an API wich you can use to add own discordcommands and discordevents to the discordbot instance or to use a custom permission provider or storage provider
Как привязать чат Minecraft к Discord?
Как игрок в Minecraft, вы, возможно, захотите ознакомиться с тем, как привяжите свой чат Minecraft к Discord для улучшения вашего игрового опыта и оставаться на связи с друзьями. Однако этот процесс может быть сложным, и многие люди изо всех сил пытаются найти исчерпывающее руководство о том, как это сделать.
К счастью, можно подключить чат Minecraft к Discord, используя DiscordSRV плагин. Этот плагин может синхронизировать внутриигровой чат Minecraft с каналом на вашем сервере Discord, а также предлагает ряд других функций. В этой статье мы объясним, как установить плагин DiscordSRV и как связать чат Minecraft с Discord. Как привязать чат Minecraft к Discord
Если вы также используете Xbox и у вас возникли проблемы с подключением к Discord, вы также можете узнать, как исправить проблему с неработающим Xbox Discord. Если нет, то давайте углубимся в дело!
Как связать чат Minecraft с Discord и что такое DiscordSRV?
DiscordSRV — это мощный плагин, который может синхронизировать внутриигровой чат Minecraft с каналом на вашем сервере Discord. Этот плагин также предлагает дополнительные функции, такие как привязка учетных записей Discord и Minecraft, синхронизация псевдонимов/ролей, голосовой чати удаленное управление консолью Minecraft через Discord.
Прежде чем мы углубимся в шаги, вот некоторые предварительные условия, которые вам необходимо выполнить:
- Убедитесь, что у вас есть сервер Minecraft на основе Буккит APIнапример патрубок, Бумагаили КрафтБуккит сервер.
- Включите режим разработчика в своей учетной записи Discord. Для этого откройте Discord, перейдите в раздел «Пользовательские настройки“, Открой “Передовойвкладку и включите «Режим разработчика».
- Убедитесь, что вы являетесь сервером администратор или владелец.
Теперь давайте начнем с того, как подключить чат Minecraft к Discord с помощью плагина DiscordSRV. Как связать чат Minecraft с Discord: DiscordSRV
Загрузите и установите плагин DiscordSRV.
- Откройте браузер и посетите страницу DiscordSRV, чтобы скачать плагин.
- Откройте свой сервер Minecraft и перейдите к «/плагины” папка.
- Открой “Загрузки» на вашем ПК.
- Щелкните правой кнопкой мыши плагин DiscordSRV и копироватьэто.
- Вернитесь на свой сервер Minecraft «/плагиныпапка и вставить скопированный плагин.
- В папке вашего сервера Minecraft нажмите «Бегать», чтобы перезапустить сервер.
- Файл конфигурации будет сгенерирован после перезапуска сервера.
Создайте бота в дискорде
После установки плагина вам нужно будет создать бота Discord. Это важный шаг в процессе, так как он позволит вам связать ваш чат Minecraft с сервером Discord. Чтобы создать бота, вам необходимо получить доступ к порталу разработчиков Discord и следовать инструкциям по созданию нового приложения. После того, как вы создали своего бота, скопируйте «Идентификатор приложения» и используйте его, чтобы добавить бота на сервер, на котором вы хотите использовать чат Minecraft. Вот конкретные инструкции:
- Откройте браузер и получите доступ к Портал разработчиков Discord.
- Нажмите «Новое приложение” кнопка.
- Назовите своего бота и нажмите кнопку «Создавать” кнопка.
- После создания найдите бот под вашими приложениями и нажмите на него.
- Нажмите «Ботраздел слева.
- Найдите вариант «Намерение членов сервера», включите его и нажмите кнопку «Сохранить изменения” кнопка.
- Открой “Общая информация» и скопируйте «Идентификатор приложения».
- Откройте браузер, вставьте этот URL (
При этом вы сможете создать нового бота Discord и добавить его на свой сервер. Далее вам нужно настроить плагин, чтобы иметь возможность его использовать.
Настроить плагин
- Откройте папку Minecraft Server и получите доступ к «/плагины” папка.
- Найди “DiscordSRV» и откройте его.
- Найдите «конфигурация» и откройте его с помощью программы-редактора.
- Когда файл откроется, прокрутите вниз и найдите «Токен бота” раздел.
- Вернитесь в браузер и скопируйте Идентификатор приложения.
- Вставьте скопированный идентификатор в поле «Токен бота» в конфигурационном файле. Убедитесь, что идентификатор заключен в кавычки и заменяет существующие символы.
- Прокрутите вниз до «каналы” раздел.
- Вернитесь в Discord, щелкните правой кнопкой мыши канал, который вы хотите использовать для чата Minecraft, и скопируйте его идентификатор.
- Вставьте идентификатор в файл конфигурации в «каналы” раздел.
Чтобы перейти к последнему шагу, вам необходимо перезапустить сервер Minecraft. Если вы этого не сделаете, возможно, вы не сможете зарегистрировать изменения, которые вы только что сделали на самом сервере. Как связать чат Minecraft с Discord: Вам также может понравиться использование пользовательского интерфейса Discord в игре.
Свяжите свой чат Minecraft с Discord
- Присоединитесь к своему серверу Minecraft и введите команду в чате, чтобы убедиться, что плагин DiscordSRV работает. Введите «/discord test» и нажмите Enter. Если это сработает, вы увидите сообщение в чате Discord.
- Теперь начните печатать в чате Minecraft, и ваши сообщения появятся на вашем канале Discord.
Что ж, поздравьте себя с трудом! Теперь вы должны успешно связать свой чат Minecraft с Discord с помощью плагина DiscordSRV.
Подключение чата Minecraft к Discord может улучшить ваш игровой опыт и помочь вам оставаться на связи с друзьями. Хотя этот процесс может показаться сложным, выполнение шагов, описанных в этом руководстве, сделает его простым и понятным. Не забудьте убедиться, что вы выполнили предварительные условия перед началом, а после завершения наслаждайтесь игрой в Minecraft с друзьями, оставаясь на связи в Discord.
DiscordSRV
The most powerful, configurable, open-source Discord to Minecraft bridging plugin available.
Created a year ago
Updated 4 months ago
The most powerful, configurable, open-source Discord bridge plugin out there.
Supports All Minecraft Versions from 1.7.9 to 1.20.1
We only give support for the latest release/dev builds; please update before asking for help
Features
- Bridge between Minecraft and Discord chats
- Forward your Minecraft Console to a Discord text channel
- Broadcast alerts based on certain events
- Voice Proximity through the Discord Voice Chat ( voice.yml )
- Require linking accounts (or certain role/s) to play ( linking.yml )
- Support for popular chat plugins (listed below)
- Highly customizable
Plugins we hook into:
Vanish
World
Plugins that use our API:
Intended usage
By using this plugin, you are able to give players the ability to chat in-game with players on your Discord server, as well as having people on the Discord server be able to chat with people in the minecraft server — This can be useful for players that still want to communicate with players in-game, but can’t access the Minecraft server for whatever reason.
This plugin has a remote console feature. You can designate a text channel for the plugin to forward console messages, which also runs all messages sent into that channel as commands by the server console (You should restrict sending this channel to a developer or high ranking role only). Due to how Discord’s permissions work, you can have some server roles have access to see the console, while also not allowing them to send messages in that channel, thus creating a read-only console for trusted staff members.
Both chat and console are toggleable through the configuration file. Some options can be refreshed with /discordsrv reload by an OP or a player with the discordsrv.reload permission.
Bot Permissions
Server Permissions
experimental webhook usage (Server-wide permission is recommended, but can be applied on a per-channel basis)
Channel Permissions
Read Text Channels & See Voice Channels and Send Messages
Required for DiscordSRV’s channel options (including console and voice lobby), the voice module category and any other channels you want for canned responses
optionally for embedding ingame-posted links and required when embed messages are used death, join/Leave
Mention @everyone, @here and All Roles
Add Reactions and Read Message History
for when the bot reacts with "" and "❗" to notify a truncated message is being sent from Discord to Minecraft
Move Members , Mute Members and Manage Permissions
Installation
Visit the Installation page for clear and in-depth instructions on installing and setting up DiscordSRV.