{"id":15042245,"url":"https://github.com/0n1udra/slime_server","last_synced_at":"2025-04-12T08:13:48.299Z","repository":{"id":37656918,"uuid":"295228900","full_name":"0n1udra/slime_server","owner":"0n1udra","description":"Control Minecraft server and more with Python Discord bot.","archived":false,"fork":false,"pushed_at":"2024-08-20T03:57:26.000Z","size":2552,"stargazers_count":70,"open_issues_count":0,"forks_count":21,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T08:13:40.544Z","etag":null,"topics":["discord-bot","discord-bots","discord-minecraft-bot","discord-minecraft-integration","discord-py","discord-py-bot","discord-python-bot","discordapp","discordbot","minecraft","minecraft-discord","minecraft-discord-bot","minecraft-server","python","python-3","python-minecraft","python-minecraft-bot","python3","rcon","tmux"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0n1udra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-13T20:07:58.000Z","updated_at":"2025-02-27T14:14:07.000Z","dependencies_parsed_at":"2024-04-16T20:38:36.318Z","dependency_job_id":"1c11a0c5-57cc-4d75-8f74-0c86131a0b6e","html_url":"https://github.com/0n1udra/slime_server","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0n1udra%2Fslime_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0n1udra%2Fslime_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0n1udra%2Fslime_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0n1udra%2Fslime_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0n1udra","download_url":"https://codeload.github.com/0n1udra/slime_server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248537144,"owners_count":21120711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["discord-bot","discord-bots","discord-minecraft-bot","discord-minecraft-integration","discord-py","discord-py-bot","discord-python-bot","discordapp","discordbot","minecraft","minecraft-discord","minecraft-discord-bot","minecraft-server","python","python-3","python-minecraft","python-minecraft-bot","python3","rcon","tmux"],"created_at":"2024-09-24T20:47:01.976Z","updated_at":"2025-04-12T08:13:48.276Z","avatar_url":"https://github.com/0n1udra.png","language":"Python","funding_links":["https://www.paypal.me/dxzt"],"categories":[],"sub_categories":[],"readme":"## Control Minecraft server with Discord bot.  \n- Configure depending on if bot is on the same computer as server, or using RCON for remote control.  \n- Interface with server using RCON, Tmux/Screen or subprocess. Some features are disabled if using RCON or Subprocess.  \n  - NOTE: Some features will not work if on Windows, you can use something like [WSL](https://learn.microsoft.com/en-us/windows/wsl/install).  \n  - Optionally run the bot and server inside the same or different Tmux/Screen sessions.  \n  - The bot can use Tmux/Screen to send commands to the server, or use the Python subprocess module to run and manage the server.  \n  - Some features depend on if you have read/write access to server files (server.jar, logs, property files, etc).  \n  - If using Tmux/Screen or subprocess to control the server, the bot has to send a `xp` command with a randomly generated number so the bot can read the output properly.  \n    - NOTE: This is disabled when using RCON.  \n    - If you have better ways so it doesn't clog up the logs, lmk!  \n- Basic commands: say, kick, teleport, save, weather, and gamemode.  \n- Show connection history, chat log, online players, banned, OP list, and whitelist.  \n- World save backup and restore system. Also has server folder backup/restore feature. These features need direct access to server files.  \n- Server autosave, start, stop, status, version, log, update server.jar (only with Vanilla or PaperMC), and edit server.properties.  \n\n---\n\n- Join Discord server for bot help: https://discord.gg/s58XgzhE3U\n- See releases (may not have latest code): https://github.com/0n1udra/slime_server/releases  \n- Download latest commit (.zip): https://github.com/0n1udra/slime_server/archive/refs/heads/master.zip\n- Jump to: [Guide](#setup), [Screenshots](#screenshots), [Support me](#support-me)  \n\n### TODO List\n- Discord user and role specific permissions for certain commands and/or command groups.\n- Be able to setup and change bot and server settings without having to edit user_config.json file.\n- Show command usage for more commands.\n \n\n### Requirements\n- [Python 3.8+](https://www.python.org/)\n- [Java 64bit](https://www.java.com/en/download/linux_manual.jsp) (If bot starting Minecraft server)\n- [Tmux](https://github.com/tmux/tmux/wiki)/[Screen](https://www.gnu.org/software/screen/) (Optional)\n- [WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10) (Optional if on Windows)\n\n### Python Modules\n- [discord.py 2.0](https://github.com/Rapptz/discord.py)\n- [asyncio](https://docs.python.org/3/library/asyncio.html)\n- [file-read-backwards](https://pypi.org/project/file-read-backwards/) (Needed for reading server log file (for now))\n- [mctools](https://pypi.org/project/mctools/) (If using RCON)\n- [subprocess](https://docs.python.org/3/library/subprocess.html), [requests](https://pypi.org/project/requests/), [datetime](https://docs.python.org/3/library/datetime.html), [fileinput](https://docs.python.org/3.9/library/fileinput.html), [random](https://docs.python.org/3/library/random.html), [gzip](https://docs.python.org/3/library/gzip.html), [json](https://docs.python.org/3/library/json.html), [csv](https://docs.python.org/3/library/csv.html), [sys](https://docs.python.org/3/library/sys.html), [os](https://docs.python.org/3/library/os.html), [re](https://docs.python.org/3/library/re.html)\n- [beautifulsoup4](https://pypi.org/project/beautifulsoup4/) (For `?serverupdate` feature)\n\n\n# Setup\n1. Create Discord bot in Discord Developer Portal. Scroll down for instructions or click [here](#create-discord-bot)  \n3. Setup Python venv (if using) and install libraries. Scroll down for instructions or click [here](#using-virtualenv-or-venv).  \n4. Update settings by editing `user_config.json` variables. Scroll down for more or click [here](#user-configs)  \n    - NOTE: JSON file uses double quotes for strings.  \n    - Also, Do NOT edit the `example` server config entry.  \n5. Run `python3 run_bot.py help`, shows commands to setup tmux and/or run bot.\n  - `python3 run_bot.py makefolders` - Create required folders if starting from scratch.\n  - `python3 run_bot.py startbot` - Starts bot.\n  - `python3 run_bot.py attachbot` - Attach to tmux/screen if using.\n  - `python3 run_bot.py startbot attachtmux`\n6. Use `?setchannel` or `?sc` command to set channel id. This is optional, any command issued to the bot will update the channel_id, however you may not see an output for that command until reissued.\n7. Read through the help pages with `?help` or `?help2` in Discord.\n8. Optionals:\n  - Use `?serverscan` command to add servers you manually put in the 'servers' folder.\n  - You can use `?update` to download latest .jar file (Downloads latest PaperMC by default, more details in `slime_vars.py` comments, line 63)\n\n\n### Commands  \n- `?help`, `?help2` - Help pages. First one is my custom embed layout, second one is default discord.py format.  \n- `?start`, `?stop`, `?restart` - Start/stop Minecraft server.  \n- `?check` - Check if server is online, and if console is reachable, if able.  \n- `?status` - Server information: status, version, motd, address/IP, players online, etc.  \n- `?players` - Show names of online players.  \n- `?playerpanel` - Common bot commands and functionality using discord.py components.  \n- `?teleportpanel` - Easy to use teleport panel. Includes return button to return teleported player to previous position.  \n- `?playerlocate` - Get xyz coords of player.   \n- `?serverproperties` - Show or edit properties in server.properties file.  \n- `?worldbackup`, `?worldrestore`, `?serverbackup`, `?serverrestore` - Manage world and server backups.  \n- `?serverlog`, `?chatlog`, `?connectionlog`, `?botlog` - Show logs for: server, just player chats, server connections and bot.  \n- `?update` - Update server .jar file.   \n  - The bot checks the server name and description configs to determine what flavor of server to get.  \n    E.g. If `papermc` is in the server description, it'll get the latest PaperMC jar from official site.  \n  - Currently working: vanilla, papermc  \n- `?botupdate` - Uses Git CLI to pull the latest update from Master branch.   \n   Note: Will not work if there's local changes. Either stash them or use `git restore .` in source folder.  \n\n### User Configs\n#### File Structure:\n- Either use `python3 run_bot.py makefolders` to create these folders or create your own and update the paths in configs.  \n  - Above command will create `Games` folder in your home directory if it doesn't exist. Then `Minecraft`, `servers`, `world_backups`, and `server_backups` inside.   \n  \nExample folder structure:\n```\nHome (home_path, e.g. ~/ or C:\\Users\\0n1udra)\n└─ Games\n    └─ Minecraft (mc_path)\n       ├─ servers (servers_path)\n       │  ├─ papernc (server_path, e.g. ~/Games/Minecraft/servers/papermc)\n       │  │  └─ server.jar\n       │  └─ vanilla\n       │     └─ server.jar\n       ├─ server_backups\n       │  ├─ papermc (server_backups_path)\n       │  └─ vanilla\n       └─ world_backups\n          ├─ papermc (world_backups_path)\n          └─ vanilla\n ```\n\n#### Bot Configs:  \n- `use_pyenv`, `pyenv_activate_command` - If using python virtual environment.  \n- `bot_launch_command` - Set custom arguments when launching bot.  \n- `show_sensitive_info` - Show or hide sensitive info in launch banner.  \n- `disabled_commands` - Disable specific commands. Must put original command name not aliases if you want to completely disable it.  \n- `bot_token_filepath` - Path to Discord token file.  \n- `command_prefix`, `case_insensitive` - Discord command prefix, and command case insensitivity.  \n- `players_custom_status`, `custom_status_interval` - Show players online and server ping in bot's custom status section.  \n  - `use_custom_ping_address`, `custom_ping_address` - Set a custom address for the ping section.  \n- `bot_use_tmux`, `bot_tmux_name`, `bot_tmux_pane` - Run bot in a Tmux session. \n  - NOTE: Set `bot_tmux_name` and `server_tmux_name` to the same to run them both in the same session.\n    currently only supports the bot and one Minecraft server.  \n- `bot_use_screen`, `bot_screen_name` - Run bot in a Screen session.  \n- `home_path`, `bot_source_path`, `mc_path`, `servers_path` - Used for setting default configs for bot and servers.  \n- `user_config_filepath`, `bot_log_filepath` - Miscellaneous variables needed for bot.  \n- `windows_compatibility` - Bot will automatically detect if running on Windows system.\n  This is Needed to adapt some commands to work for Windows, like starting Minecraft server.  \n- `windows_cmdline_start` - Bot will prefix this to `server_launch_command` to start server.  \n- `selected_server`, `init` - More miscellaneous configs needed for bot functionality.   \n \n#### Server Configs:\n- `server_name`, `server_description`, `server_version` - Basic server info.  \n  - NOTE: Bot will try to detect server version. If it doesn't work, you can set it manually. however, it might be overridden by the bot if it successfully detects a version.  \n- `server_address`, `server_port` - Server domain/IP and port. Not needed, but some features may not work properly.  \n- `server_use_essentialsx` - EssentialX plugin compatibility.   \n  - NOTE: Bot will use `pong` command instead of `xp`. See `status_checker_command` below for more.  \n- `server_files_access` - If you are running the bot on the same system as the server, and it can access server files.  \n  - Needed for some features like world/server backup and restore, editing server.properties file, etc.  \n- `server_use_rcon`, `rcon_pass`, `rcon_port` - RCON configs. Uses `server_address`.  \n- `server_use_tmux`, `server_tmux_name`, `server_tmux_pane` - Run server in a Tmux session.  \n- `server_use_screen`, `server_screen_name` - Run server using Screen.  \n- `server_use_subprocess` - Run server using Python's subprocess module.  \n  - NOTE: The server will stop if the bot process is interrupted or killed.  \n- `server_launch_command` - Command used to start server. \n- `server_launch_path` - Optionally set a custom path to the server executable (usually a `.jar` file).  \n- `startup_wait_time` - This is just used to send a Discord message notifying how long the server takes to start.  \n- `save_world_wait_time` - Set how long it takes for the server to save the world after sending a `save-all` command.  \n- `check_before_command` - Only used if `server_files_access` is true. Sends a command to the server to check if it's reachable before sending actual command.  \n  - NOTE: This will clog your logs up. However, disabling this will mean the bot will not be sure if the server is reachable and if commands issued were successful or not.\n  - `status_checker_command\"` - The command that will be sent to server with a random number, then bot will check server logs to see if it was received.\n  E.g. `xp 0.123463246`.\n- `command_buffer_time` - The time it takes for the server to run commands. Change this if your server is slower.  \n- `enable_autosave`, `autosave_interval` - Send `save-all` command at specified minutes interval.  \n- `log_lines_limit` - Set limit to how many log lines bot can read for some commands, like `?chatlog`.  \n- `server_path`, `world_backups_path`, `server_backups_path`, `server_logs_path`, `server_log_filepath`, `server_properties_filepath` - Bot will automatically set these based on `mc_path`. \n  You can manually update them.  \n- `world_folders` - Specify what world folders to backup.  \n- `useful_websites` - For `?links` command, which shows a Discord embed of these links.  \n- `server_ip` - Bot will automatically set this if `server_address` is set.  \n  \n\n### Create Discord bot\n  1. Go to: https://discord.com/developers/applications.  \n  2. Create New App:  \n    \u003cimg width=50% height=50% src=\"https://github.com/0n1udra/slime_server/assets/15573136/fdcbfbd3-dc44-4d0e-ba4c-f896cc2f94c8\"\u003e   \n  2. Go to OAUTH \u003e URL Generator section to create invite link for the bot:   \n    \u003cimg width=50% height=50% src=\"https://github.com/0n1udra/slime_server/assets/15573136/1bf4ab7f-8a5c-4f26-8af1-238862980944\"\u003e   \n  Set the permissions:  \n    \u003cimg width=50% height=50% src=\"https://github.com/0n1udra/slime_server/assets/15573136/f09bd87e-ac82-443e-acc5-ef7f44ea1cac\"\u003e  \n  Invite bot to your server:  \n    \u003cimg width=20% height=20% src=\"https://github.com/0n1udra/slime_server/assets/15573136/acdb4fda-f77a-4de0-b811-9ca4778e0c09\"\u003e   \n  3. Go to Bot section and get the token if you haven't already:  \n    \u003cimg width=50% height=50% src=\"https://github.com/0n1udra/slime_server/assets/15573136/aafdcc20-d622-429d-9551-f25b532657ed\"\u003e  \n  4. While in the Bot section, scroll down and enable Message Content Intents:  \n    \u003cimg width=50% height=50% src=\"https://github.com/0n1udra/slime_server/assets/15573136/ab480973-151e-4817-bb71-ba973a962cd2\"\u003e   \n\n\n### Using Virtualenv or venv\nInstall Python3 venv:\n```bash\nsudo apt install python3-venv -y\n```\nCreate Python Virtualenvt:\n```bash\npython -m venv ~/pyenvs/slime_server \n```\nActivate new Python Virtualenv:\n```bash\nsource ~/pyenvs/slime_server/bin/activate\n```\nInstall required Python modules:\n```bash\npip install -r requirements.txt\n```\n\n\n# Screenshots\n\u003cimg width=\"800\" alt=\"Screen Shot 2021-12-04 at 22 33 54\" src=\"https://user-images.githubusercontent.com/15573136/144732439-82c696df-56c9-4024-b93b-30d78958cfa3.png\"\u003e  \n\u003cimg width=\"800\" alt=\"Screen Shot 2021-12-04 at 22 57 41\" src=\"https://user-images.githubusercontent.com/15573136/144732861-278016b7-e3f8-44ba-8352-10a9f1d3438e.png\"\u003e  \n\u003cimg width=\"1362\" alt=\"Screen Shot 2022-04-12 at 6 59 20 PM\" src=\"https://user-images.githubusercontent.com/15573136/196075059-da4cc813-9a75-438e-9d6a-629a45fa4764.png\"\u003e   \n\n\n# Support me\n- PayPal [@dxzt](https://www.paypal.me/dxzt)  \n- Venmo [@dxzt550](https://venmo.com/u/dxzt550)  \n- Cash App [$DXZT550](https://cash.app/$DXZT550)  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0n1udra%2Fslime_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0n1udra%2Fslime_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0n1udra%2Fslime_server/lists"}