Git Product home page Git Product logo

hypixel-discord-chat-bridge's Introduction

Hypixel Discord Chat Bridge

A two-way chat bridge between Hypixel guild chat and a Discord channel. The application utilizes Discord.js-light for communicating with Discord, and Mineflayer for communicating with Hypixel.

This application will login to Hypixel using Mineflayer which is not a normal Minecraft client, this could result in your Minecraft account getting banned from Hypixel, so use this application at your own risk.


Table of Content

Installation using NodeJS

Prerequisites

  • Git
  • NodeJS >= 14
  • Yarn >= 1.2
  • A Minecraft account

Setup Guide

To get started, clone down the repository using:

git clone https://github.com/Senither/hypixel-discord-chat-bridge.git

Next go into the hypixel-discord-chat-bridge folder and install all the dependencies using Yarn.

yarn

While the dependencies are being installed you can copy the configuration file.

cp config.example.json config.json

Next edit and setup the config file with a proper Minecraft and Discord settings, once you're done you can start the app.

node index.js

Installation using Docker

Prerequisites

  • Git
  • Docker >= 20
  • A Minecraft account

Older versions may also work, but have not been tested.

Setup Guide

To get started, clone down the repository using:

git clone https://github.com/Senither/hypixel-discord-chat-bridge.git

Next go into the hypixel-discord-chat-bridge folder and open the docker-compose.yml file, within the file you'll find all the environment variables that can be used to setup the bot, you should fill replace the default values with your real Discord and Minecraft login info, once you're done you can start the bot using Docker.

docker-compose up -d

And you're done! The command will start a detached instance of the bot, and ensure that the container is deleted after you're done using it.

Deploy directly to Replit

Prerequisites

You'll need a GitHub account to deploy directly to Replit, as well as a Replit account that is linked with your GitHub account, if you don't already have a Replit account you can simply sign in with your GitHub account directly.

Setup Guide

  1. First fork this project onto your own GitHub account, once you have a copy of the project on your own account, sign in to Replit and import the project into Replit.
  2. Now that the project is imported you should be able to click on the project in the Replit dashboard to create a new project from it, when the project has been created you should be able to select some settings about the project, make sure the selected language is set to Node.js, you can leave the "configure the run button" settings as the default.
  3. Next, copy or rename the config.example.json file to config.json, you can find the files on the left-hand side of the Replit dashboard, when the file has been copied or renamed you should open the file and setup the settings, such as the Minecraft account details, and the Discord information
  4. Lastly you'll need to install all the dependencies for the project, this can be done by selecting the "Shell" tab which should open the shell command prompt, then in that write yarn install to install all the dependencies.
  5. Now that the dependencies are installed you're now ready to start the project, just click on the big "Run" button at the top of the screen, and wait for the project to be booted up, after the project is up and running you should see two messages in the Console tab indicating that both the Discord and Minecraft clients have connected and are ready to be used.

Configuration

Server

The server is the server the Minecraft client should connect to, by default it will point to Hypixels server so it can be left as-is if the plan is to use the app for Hypixel guild chat, if not then the host is the servers IP or hostname, and the port is the port the server is running on.

Note: The port must be a number, Mineflayer expects an integer so you can't wrap the port in quotes or Mineflayer won't create a connection to the Minecraft server.

Minecraft

The minecraft section includes a username and password option, if using a Mojang account these should be filled out with your Mojang username and password for the Minecraft account you plan on using, your Minecraft username is most likely the email it was created with. If using with a microsoft account change accountType to microsoft, username and password are not required and will be left blank as you will be directed to the Microsoft Link page. There is also a lobbyHolder option which is used in the !guildlobby command, this command will whisper the user specified in the config with a message using the ?tw <username> format, for this command to do anything another bot needs to listen, and then act when receiving the message.

Discord

The Discord options includes the token, channel, commandRole, ownerId, prefix and messageMode options.

The token is the Discord application token, if you don't already have a Discord App, you can create a new app, then convert the app to a Discord bot, and then get your Discord bot token on the "Bot" page.

The Discord channel is the ID of the text channel the bot should be linked with, the bot will only send and listen to messages in the channel defined in the config.

The command role is the ID of any role on the server the bot is hosted for, any user with the role will be able to run all the Discord commands built into the bot, like !kick and !relog.

Note: Any user can run the !help command, however all the other commands requires the user has the command role.

The owner ID is similar to the command role, however this is the ID of the user that should have full access to the !override command, the user with this permission can use the command to run virtually any command via the bot, and should therefore be limited to just the owner of the bot.

The prefix is the command prefixed used for all the commands in the bot on the Discord side, by default this is set it !.

The messageMode can either be bot or webhook. This selects how the messages should be displayed when sent from Minecraft to Discord. If webhook mode is selected the bot requires the Manage Webhooks permission in the channel it's running in. The bot always requires the Send Messages and View Channel permissions in the channel you're using it in.

Note: The Discord rate limit for webhooks is 30 requests every 60 seconds, whereas for normal bot messages it's 5 messages every 5 seconds. Using webhooks effectively halves the number of messages the bot can send per minute which may cause issues in an active guild.

Express

The express section includes an option to enable/disable the express API option. If enabled, this will allow you to locally send requests to your bridge bot via other applications, and globally if you have port forwarding enabled.

The port option allows you to set what port you want to host your API on.

The authentication option is the key which you can put in the header or query of your request. This allows security as only people with the authentication key will be able to successfully send requests to your API.

Commands

< > = Required arguments, [ ] Optional arguments

  • !help - Displays the list of commands (!h)
  • !relog [delay] - Relogs the MC client, a delay can be given in seconds, if no delay is given it will default to 5 seconds (!r)
  • !override <command> [args] - Executes the string attached. This is a dangerous permission to grant (!o, !or)
  • !invite <player> - Invites the specified user to the guild, providing the guild isn't full (!i, !inv)
  • !kick <user> [reason] - Kicks the specified user from the guild (!k)
  • !promote <user> - Promotes the specified user by 1 rank (!p, !up)
  • !demote <user> - Demotes the specified user by 1 rank (!d, !down)

Roadmap

  • Chat message filter
    • The filter should block any messages sent from Discord to Hypixel that contains banable words, and words that could potentially cause a mute.
  • Log guild events
    • Guild joins/leaves/kicks, mutes/unmutes and promotion/demotions
  • Ingame commands
    • Add commands for players to use ingame to check other player stats (eg !skills <ign>, !weight <ign> etc)
  • Add support for officer chat
    • Allocate a second discord channel to use for two way officer chat.

License

Hypixel Discord Chat Bridge is open-sourced software licensed under the MIT License.

hypixel-discord-chat-bridge's People

Contributors

dependabot[bot] avatar itsneyoa avatar jonerrr avatar nickisnoobatcode avatar senither avatar sergeantsar avatar worldwidewaves avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hypixel-discord-chat-bridge's Issues

arm64 version on Docker Hub

Hello,
I was just curious if you wouldn't mind uploaded a arm64 version of this repository to Docker Hub. My cluster runs on arm64 nodes and it would be really nice to not have to compile this myself since you already have the job created.

Error message

Haha hey again. This error shows up when I try to run the bot. It's on my old pc that used to have it but I deleted it and now I'm reinstalling it
Screenshot 2021-10-05 231721

aa is just what I renamed hypixel-discord-chat-bridge-master

Console Issue

t
Whenever i start the bot I get this error, any suggestions on how to fix it?

Replit Node outdated

--> yarn install
yarn install v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=14". Got "12.22.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
exit status 1

Is there somehow I can update? I looked around and also tried the Skyblock Facade way (using the tsconfig file) to no avail

Ingame commands

I can't seem to find a way to get them to function. Are they released yet?

Error message

image
I get this message when I try to run node index.js in cmd prompt. Can you please help?

Error when using a Microsoft Account

Hi, I'm trying to setup a bridge bot using an alt for my guild, however the alt is a microsoft account rather than a mojang account. In MinecraftManager.js I've changed auth: 'mojang' to auth: 'microsoft' as below/

createBotConnection() {
    return mineflayer.createBot({
      host: config.server.host,
      port: config.server.port,
      username: config.minecraft.username,
      password: config.minecraft.password,
      version: false,
      auth: 'microsoft',
    })
  }

The error this gives is

\hypixel-discord-chat-bridge-master\node_modules\minecraft-protocol\src\client\microsoftAuth.js:27
      if (err.details) throw new Error(`Unable to authenticate with Xbox Live: ${JSON.stringify(err.details)}`)
                             ^

Error: Unable to authenticate with Xbox Live: {"statusCode":401,"reason":"UNAUTHORIZED"}
    at \hypixel-discord-chat-bridge-master\node_modules\minecraft-protocol\src\client\microsoftAuth.js:27:30
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
    at async module.exports (\hypixel-discord-chat-bridge-master\node_modules\minecraft-protocol\src\client\microsoftAuth.js:25:25)

I've tested with my main (mojang) account and it works perfectly, but I'd rather not use that for a chat bridge.
Any help you could give would be greatly appreciated, thanks in advance :)

Solved

image
Not sure why it is not working.

Is it possible to code my own API related commands? (Like !weight or !skills)

I recently switched from this version to another version that I coded myself due to my Guild requesting API commands. While this is using API commands like !weight and !catacalc (that calculates how much xp till the next cata level) But I'm noticing issues like the Discord bot not picking up a few messages sometimes. Or the API commands sometimes not working. So I was wondering if it would be possible to code my own API related commands in this bot. And a way to add Officer bridge since that is also a feature that the Officers in the Guild like. Since i would like to switch back to this version because it is more stable.

Also I'm not sure if I should put this in here or in Pull requests.

Express

I am trying to get the API working but it keepy throwing out Malformed body. Im using CURL to test it out this is my command.
curl -i -X POST -H -d "{message:"a"}" "http://localhost:8880/override?&key=pele"

Trouble with new file

So when I was last using this I had a diff pc, but I got a new one and I'm setting it up on it. Before I could just find a .json file editor and fill out the config.json but now that file isn't there, only the config.example.json. Which one do I fill out for the mc account and discord stuff?

Ingame Commands

I'm new to github so sorry if I'm not formatting this correctly but, I downloaded and am using this program as a discord to hypixel guild chat bridge for my guild and its all working how its supposed to except for the in-game commands. I can do the !ping thing but when I try to do the !skills or !weight they don't work where just nothing shows up. If you need screenshots I can send some just let me know how I can help you help me.
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.