All Projects → starcraft66 → minecraft-discord-bridge

starcraft66 / minecraft-discord-bridge

Licence: Apache-2.0 license
A minecraft <-> discord bridge with no server-side requirements

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to minecraft-discord-bridge

React Native Share
Social share, sending simple data to other apps.
Stars: ✭ 2,955 (+9750%)
Mutual labels:  bridge
poa-bridge
POA <-> Ethereum bridge for self transfers of POA native token to POA20 (ERC20 representation). Not supported. Use TokenBridge instead
Stars: ✭ 75 (+150%)
Mutual labels:  bridge
WebViewJavascriptBridge
This is a communication between Android applications and Web Javascript to establish a bridge between the call support each other
Stars: ✭ 16 (-46.67%)
Mutual labels:  bridge
Websockify
Websockify is a WebSocket to TCP proxy/bridge. This allows a browser to connect to any application/server/service.
Stars: ✭ 2,942 (+9706.67%)
Mutual labels:  bridge
onionfruit
OnionFruit™ Connect - Tor access client with country selection, bridge configuration, pluggable transports and experimental DNS support
Stars: ✭ 150 (+400%)
Mutual labels:  bridge
matrix-sms-bridge
Matrix bridge, that allows you to bridge matrix rooms to SMS with one telephone number only.
Stars: ✭ 62 (+106.67%)
Mutual labels:  bridge
Doctrine Bridge
Provides integration for Doctrine with various Symfony components.
Stars: ✭ 2,800 (+9233.33%)
Mutual labels:  bridge
GitBridge
Access resources and information from the git repository containing your project.
Stars: ✭ 14 (-53.33%)
Mutual labels:  bridge
WormHole
WormHole allows to share classes between Flutter and Native Platform (android / ios)
Stars: ✭ 36 (+20%)
Mutual labels:  bridge
ligh7hau5
A Matrix (https://matrix.org/docs/spec/) to Fediverse / ActivityPub client / bridge. Also, some media proxying.
Stars: ✭ 26 (-13.33%)
Mutual labels:  bridge
FMWebViewJavascriptBridge
FMWebViewJavascriptBridge inspired by WebViewJavascripBridge and react native
Stars: ✭ 29 (-3.33%)
Mutual labels:  bridge
rn-webview-rpc
Add RPC capabilities to a React Native WebView component
Stars: ✭ 25 (-16.67%)
Mutual labels:  bridge
unity-bridge-ui-framework
🏝 a little framework base on unity and ugui,we use bridges to connect one panel to another panel
Stars: ✭ 90 (+200%)
Mutual labels:  bridge
Gdbghidra
gdbghidra - a visual bridge between a GDB session and GHIDRA
Stars: ✭ 251 (+736.67%)
Mutual labels:  bridge
bridge-ui
UI for TokenBridge, an interoperability solution between Ethereum networks for native and ERC tokens
Stars: ✭ 41 (+36.67%)
Mutual labels:  bridge
Rubypython
An in-process between Ruby and Python. Soon changing repo address.
Stars: ✭ 246 (+720%)
Mutual labels:  bridge
critter
Chat bot relaying messages between IRC and Gitter
Stars: ✭ 16 (-46.67%)
Mutual labels:  bridge
starkgate-frontend
Bridge interface allows users to transfer ERC20 tokens from Ethereum to StarkNet and vice versa.
Stars: ✭ 75 (+150%)
Mutual labels:  bridge
Matrix-EmailBridge
A bridge written in Golang to receive and write emails in matrix
Stars: ✭ 101 (+236.67%)
Mutual labels:  bridge
app-xyo-nodejs
XYO Archivist/Diviner CLI
Stars: ✭ 41 (+36.67%)
Mutual labels:  bridge

Minecraft Discord Bridge

Required Python version: 3.5 or later.

Docker is not required to run this bot but its use is strongly encouraged for ease of management.

Installation instructions

  1. Clone the repository.

  2. Edit the config.json file to your liking, an example is provided in config.example.json.

    mv config.example.json config.json
    vi config.json
    
  3. If you are using an sqlite database (like the default one in the config, create it now).

    touch db.sqlite
    
  4. Run the bridge!

    1. If you are not using docker, just install the dependencies and start the bot.

      python -m pipenv --three
      python -m pipenv install
      python -m pipenv run python -m minecraft_discord_bridge
      
    2. You may optionally specify a custom path to the json configuration file using the --config-file or -f command-line options. E.g. python -m pipenv run python -m minecraft_discord_bridge -f /path/to/custom/config.

    3. If you are using docker, just use the included docker-compose.yml to get up and running.

      docker-compose up -d
      
  5. If this is the first time you run this bridge, you need to invite it to your discord guild.

    A log message containing the invite link will be printed out every time the bridge is started. Launch the bridge and click the link in the log and follow the prompts on discord's website to add the bridge's bot to your guild.

    Once it has joined your server, create a text channel for it to post in, then press the "Edit Channel" button on that channel. From there, press the "Permissions" button and click the "+" button and add "Minecraft Chat Bridge" to the room and close the permissions window.

    Now that permissions are set, all you need to do is to do is to type "mc!chathere" and the bridge will take over if it is running.

Creating a discord bot and getting its discord token

  1. Head over to the discord developer portal and sign in if you haven't already.

  2. Press "Create an application". Once you do so, you may give the application a name and an icon if desired.

  3. From the left menu, click "Bot", then press "Add bot" on the next screen and "Yes do it" on the popup that appears.

  4. From here, you can once again give the Bot account your desired username and profile picture.

  5. Finally, Press the "Copy" button under the "Token" section to get your discord bot token. You can now paste it into this bridge's config.json file.

Creating the wildcard DNS record

This step can be achieved in a variety of ways but I will cover basic steps for setting this up using the cloudflare DNS servers.

  1. Create an account and add your domain to cloudflare

  2. From the cloudflare dashboard, click on your site and then click on the blue "DNS" icon at the top of the dashboard.

  3. From the DNS records section, select "A" in the dropdown, type any name you want in the "name" field and type in your computer's public IPv4 address into the "IPv4 address" field, then click on the orange cloud icon until it becomes gray and press the "Add Record" button. Note: If your computer is behind a NAT gateway, you will need to "port forward" the port specified in the AUTH_SERVER.PORT inside config.json to your computer's private IPv4 address.

  4. Repeat this process but choose "CNAME" from the dropdown, then type *.authentication (or anything you want as long as it starts with *.) and type whatever name you chose in step 3 into the "Domain name" box. Click on the orange cloud icon until it becomes gray and press the "Add Record" button.

  5. Set the AUTH_SERVER.DNS_WILDCARD node in config.json to the name you chose in step 4 (but without the *. part!!!) and append .yourdomain.tld to it where yourdomain.tld is the name of your domain. e.g. For the record *.authentication on domain example.com, you would write authentication.example.com.

Configuration

All of the configuration data is stored in a file called config.json that must be stored in the same directory as the executable

Local development environment

To facilitate development, a docker-based local development environment that spins up a minecraft server and a copy of the bridge from local repository source code is provided.

To use it, simply copy config.development.example.json to config.development.json and fill in your discord application token and/or change any other relevant settings, then run ./scripts/development-environment.sh.

A local offline-mode minecraft server and bridge will be started up and connect automatically. You can then connect a local minecraft client to the server by connecting to localhost:25565.

The authenication server is also reachable at localhost:9822 with the dns wildcard localhost4.tdude.co because I configured *.localhost4.tdude.co to resolve to 127.0.0.1.

Additionally, the python code running inside the container can be remotely debugged in compatible IDEs via a server speaking the Debug Adapter Protocol available at localhost:5678.

Note: Since the development minecraft server runs in offline mode, UUIDs of players will differ from their real UUID returned by the Mojang API and this may cause exceptions related to the UUID cache. This is currently a known issue and may be fixed in the future.

The development docker image can be rebuilt by running ./scripts/development-environment.sh -r if python dependencies need to be changed or for any other reason.

Json keys

Key Default value Explanation
MAIN.MC_USERNAME "" The username or e-mail address of the bot's minecraft account
MAIN.MC_PASSWORD "" The password of the bot's minecraft account
MAIN.MC_SERVER "" The IPv4 address of the minecraft server to connect to
MAIN.MC_PORT 25565 The port of the minecraft server to connect to
MAIN.MC_ONLINE true Whether or not to authenticate the bot's minecraft account with Mojang's authentications server
MAIN.DISCORD_APP_TOKEN "" The discord bot token the birdge will use to log into discord
MAIN.LOG_LEVEL "INFO" Set the log level, can be INFO or DEBUG
MAIN.MESSAGE_DELAY 1.5 Set the delay between messages sent from discord to minecraft
MAIN.FAILSAFE_RETRIES 3 The amount of times to try reconnecting to an online server before giving up and exiting.
MAIN.VANILLA_CHAT_MODE false Whether to parse chat using the vanilla server chat format or not (required on vanilla servers)
MAIN.ADMINS [283983554051047425] Array of discord user ids that have administrative access to the bot
AUTH_SERVER.BIND_IP "" The IPv4 address which the authentication server will bind to (set to blank for 0.0.0.0)
AUTH_SERVER.PORT 9822 The port which the authentication server will bind to
AUTH_SERVER.DNS_WILDCARD "" Must be set to a wildcard DNS CNAME record that points to an A record pointing to the authentication server's IP address
DATABASE.CONNECTION_STRING "sqlite:////data/db.sqlite" Must be set to any valid SQLAlchemy connection string. Defaults to an empty sqlite database in /data for docker users
ELASTICSEARCH.ENABLED false Whether or not to enable elasticsearch analytics collection
ELASTICSEARCH.URL "" Fully qualified URL to the elasticsearch server
ELASTICSEARCH.AUTH false Whether or not the elasticsearch http endpoint is protected by HTTP Basic authentication
ELASTICSEARCH.USERNAME "" HTTP Basic authentication username for elasticsearch
ELASTICSEARCH.PASSWORD "" HTTP Basic authentication password for elasticsearch
DEBUGGING.ENABLED false Whether or not to enable remote python debugging
DEBUGGING.BIND_IP "0.0.0.0" The IP address which the remote debugging server will bind to
DEBUGGING.PORT 5678 The port which the remote debugging server will bind to
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].