I heard you liked IRC & Discord so I put some IRC in your Discord.
Discord Relay Chat is an IRC client that uses Discord for an easy-to-use, comfortable UI accessible from any machine. It allows multiple server connections while ensuring stability and moderate resource consumption. With DRC, you’ll not miss out on any mentions or highlights. It also gives you the possibility of alias and kick/ban tracking. You can send attachments, take notes about channels and nicks, or even play Zork! Thanks to ChatGPT integration, you’ll always have someone to talk to.
Visit the project’s website to discover the features and potential of this tool. There is still some work to do. Fortunately, it’s open source, and contributions are accepted, so hack away!
Below you will find instructions on how to install and run the project. Additional documentation is available on DiscordRC.com
Note: documentation is not comprehensive. The source code is the ultimate reference.
- Node v18 or greater
- Redis v5 or greater
- Used primarily for inter-process communication, so is highly suggested this be running locally.
- Discord server & bot
- DRC is designed to be mainly single-tenant (one user), so you should set up a separate Discord server and associated bot for this application.
- nmap
- figlet
- Shodan API key
- IPInfo API key
- Reverse proxying webserver
- Caddy is highly recommended
- Docker if deploying on Linux
- Clone/download the repository
- Run
npm install
in the project directory - Create
config/local.json
and set the appropriate configuration- See
config/default.js
for examples and commentary
- See
In the configuration, botId
is the “Application ID” in the Discord Developer portal.
The Discord bot must have “Message Content Intent” & “Privileged Gateway Intents” enabled to function correctly.
- Create a special channel in no category (or at least not in any of the special categories you’ll create in the next step) for the bot’s status, notice et. al messages.
- Add this channel’s ID to the configuration in the (truly terribly-named)
irc.quitMsgChanId
field.
- Add a category for each IRC server, named for that server e.g.
irc.libera.chat
. - Add a channel in that category for each IRC channel you wish to join on connect.
- Add to
config/channelXForms-NODE_ENV.json
with required name transforms! You can also adjust these from the client at any time with the!channelXforms
command.
To control which Discord users can speak as your IRC user, create a Role in your guild and add users to it you wish to allow to speak and use DRC in your server. Set the ID of this role as config.app.allowedSpeakersRoleId
.
DRC uses the config
module and as such follows these rules as to which configuration file will be used.
default.js
both specifies all default values as well as illustrates the expected structure. As a hobby project, some of the names have been very poorly chosen. You have my apologies.
The following configuration parameters must be set by you, the user for the system to function correctly:
app.allowedSpeakersRoleId
orapp.allowedSpeakers
discord.botId
discord.guildId
discord.token
irc.quitMsgChanId
If you create a category with a name that matches this logic* - such as “Private Messages”, “privmsgs”, or “PMs”) - DRC will automatically create a channel in this category for each private message received (a la traditional IRC client’s “query window” feature).
In order for this feature to properly expire these channels after config.discord.privMsgChannelStalenessTimeMinutes
have elapsed, your Redis server must have “Kx”
keyspace notifications enabled!
* x.match(/priv(?:ate)?\s*me?s(?:sa)?ge?s?/ig) || x === 'PMs'
at the time of this writing
(Note: These instructions will work only on Linux due to the networking mode used. Proceed to the next page to learn how to run it manually if you won’t be deploying on Linux.)
Run redis
as a regular ‘ol system service.
Put your specific configurations into local-prod.json
(and other *-prod.json
files as necessary).
.app.log.path
and.irc.log.path
must not be modified/overridden; leave them as their defaults. You must set the environment variableDRC_LOGS_PATH_HOST
to a fully-qualified path on the host where your logs are kept.
All of the following docker compose
invocations must be run in this directory.
Start everything:
$ export DRC_LOGS_PATH_HOST=/home/myuser/.drc/logs
$ docker compose up -d
Watch the logs with docker compose logs -f
To stop everything: docker compose down
In the project directory:
- Run
node http.js
to start the (optional) web server - Run
node discord.js
to start the Discord bot - Run
node irc.js
to start the IRC bridge
If any of the required secrets (Discord bot API key or IRC account passwords) are not provided in the configuration file, they will be interactively prompted for. Accordingly, the most secure way to run this application is from within a terminal multiplexer like screen or tmux and not configure any secrets, entering them on each run so they never live on the filesystem nor in a process environment.
You may set DEBUG=1
in the environment to enable more-verbose logging from any of the daemons.