Jump to content
  • Sign Up

Archived

This topic is now archived and is closed to further replies.

aleksb385

How to set up a server->irc->discord bridge

Recommended Posts

If you are only planning on using IRC to connect your ClassiCube server to Discord and you are running MCGalaxy, you're better off just using its inbuilt Discord relay bot. More info can be found here.

This tutorial is still valid, however, and you can still use IRC if you wish.

 

 

Hello!

In this tutorial, I will be showing you how to set up a bridge between a ClassiCube server, IRC, Discord and back.

Prerequisites:

  • A server running software which supports IRC (MCGalaxy is the most common one)
  • A computer which has a terminal prompt and supports Node.js/npm (this is unlikely, but possible to work on chromebooks)
  • A Discord account (so you can create the bot)
  • A brain

 

1. Set up IRC on your ClassiCube server

On MCGalaxy, this is somewhere in properties/server.properties. Just enable IRC, keep the server and port as they are, don't put anything in OP channel and put whatever you want for channel. (Make sure that it starts with # though). I'll use #example for this tutorial.

 

2. Install npm (what is npm?)

On Linux, you can use your package manager of choice to install npm. Examples:

Ubuntu (and other Debian-based distros)

sudo apt install npm

 

Arch:

sudo pacman -S npm

Note: you may need to additionally install Node.js as well, haven't tried it myself.

On Windows and macOS, you will have to download and install it from Node.js's download page. It is recommended that you use the LTS version, but "Current" works as well.

 

3. Create a configuration file for discord-irc

Go to a new directory which you'll use for your bot and create a new .json file. Here is what you'll put in it (explanations for the numbers will be given below):

 {
    "nickname": "1",
    "server": "2",
    "discordToken": "3",
    "channelMapping": {
      "4": "5"
    }
  }

1 - Replace this with the nickname of the bot. This will be seen in-game and from the IRC channel. It is recommended that you just set this to "Discord".

2 - Replace this with the IRC server you're using. MCGalaxy uses "irc.esper.net" by default.

3 - Replace this with your Discord bot's token (NEVER SHARE IT WITH ANYONE ELSE!). More instructions in step 4.

4 - Replace this with the Discord channel's ID. Essentially, all messages will be sent in that channel. To get a channel's ID, right-click it and click "Copy ID". If you don't see this, enable Developer Mode from the Advanced section of the Discord settings.

5 - Replace this with the IRC channel's name. If you set your MCGalaxy server's IRC channel to #example, put #example there.

Note: you can expand this file with more options if you want. This is just the very minimal version.

 

 

4. Create a new Discord bot and get its token

Creating a Discord bot is easy, you just have to go to My Applications on the Discord Developer Portal, create a new application, then create a bot for it. Once that is done, click the button to copy the token and insert it into the json file you made above. Once again, do NOT share your token with anyone, ever.

 

5. Install discord-irc and run the bot

Open a terminal prompt (cmd.exe or powershell works on Windows) and cd to the directory in which the .json file is located, then install discord-irc using npm by writing this:

npm i -g discord-irc

and pressing Enter/Return. After this, wait until it's installed. If it doesn't let you install it, try putting sudo before npm. (so sudo npm i -g discord-irc). This will give you root permissions and works only on Linux, you will also need to input your user password.

 

Once discord-irc is installed, make sure that you are in the .json file's directory and run this from the terminal:

discord-irc --config <name>.json

The bot should be running and should be relaying messages to/from the IRC, which by itself is connected to the ClassiCube server. To stop the bot, press Ctrl+C.

You can also run discord-irc from different directories, just use --config /path/to/<name>.json as the arguments.

 

That's it!

If you have any questions, extra tips or have anything to say about this, please let me know. Have a nice day and I hope this helps you!

~Alex

Share this post


Link to post

Note, discord-irc requires Node.js 12 or newer. If your distribution or operating system does not support or ship with Node.js 12+ you have to install it from the Node.js official repos.

Share this post


Link to post

I fixed up some inaccurate information in the tutorial, hopefully it should be more helpful now.

Share this post


Link to post

Note: Since Discord relay support was added to MCGalaxy natively, you might be better off just using its built-in relay bot instead of routing messages through IRC. More information on how to set that up can be found here: https://github.com/UnknownShadow200/MCGalaxy/wiki/Discord-relay-bot

Share this post


Link to post

×
×
  • Create New...