Convert Figma logo to code with AI

reactiflux logodiscord-irc

Connects Discord and IRC channels by sending messages back and forth.

1,200
293
1,200
72

Top Related Projects

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)

2,255

A modern IRC server (daemon/ircd) written in Go.

Quick Overview

Reactiflux/discord-irc is a Node.js application that bridges Discord and IRC channels, allowing messages to be relayed between the two platforms. It enables seamless communication between Discord users and IRC users, making it easier to maintain a presence on both platforms simultaneously.

Pros

  • Enables cross-platform communication between Discord and IRC
  • Supports multiple channel pairs and servers
  • Customizable nickname formatting and message relay options
  • Active development and community support

Cons

  • Requires Node.js environment for deployment
  • May require additional configuration for complex setups
  • Potential for message sync issues in high-traffic channels
  • Limited support for advanced Discord features (e.g., embeds, reactions)

Code Examples

  1. Basic configuration example:
module.exports = {
  discord: {
    token: 'YOUR_DISCORD_BOT_TOKEN',
    channel: 'discord-channel-name',
  },
  irc: {
    server: 'irc.example.com',
    channel: '#irc-channel-name',
    nickname: 'Discord-Bot',
  },
};
  1. Multiple channel configuration:
module.exports = {
  discord: {
    token: 'YOUR_DISCORD_BOT_TOKEN',
  },
  channels: [
    {
      discord: 'discord-channel-1',
      irc: '#irc-channel-1',
    },
    {
      discord: 'discord-channel-2',
      irc: '#irc-channel-2',
    },
  ],
  irc: {
    server: 'irc.example.com',
    nickname: 'Discord-Bot',
  },
};
  1. Custom nickname formatting:
module.exports = {
  // ... other config options
  ircNickFormat: (discordNick) => `${discordNick}_discord`,
  discordNickFormat: (ircNick) => `${ircNick} (IRC)`,
};

Getting Started

  1. Install Node.js and npm
  2. Clone the repository: git clone https://github.com/reactiflux/discord-irc.git
  3. Install dependencies: npm install
  4. Create a config.js file with your Discord and IRC settings (see examples above)
  5. Start the bridge: npm start

For more detailed instructions and advanced configuration options, refer to the project's README on GitHub.

Competitor Comparisons

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)

Pros of Matterbridge

  • Supports a wider range of chat platforms, including Discord, IRC, Mattermost, Slack, and more
  • Offers more advanced features like file transfer and user avatars
  • Actively maintained with regular updates and improvements

Cons of Matterbridge

  • More complex setup and configuration due to its broader scope
  • Potentially higher resource usage when bridging multiple platforms
  • May have a steeper learning curve for users new to chat bridges

Code Comparison

Matterbridge (Go):

func (b *Bridge) handleDiscord() {
    for msg := range b.discord.Messages {
        b.handleDiscordMessage(msg)
    }
}

Discord-IRC (JavaScript):

client.on('message', message => {
  if (message.author.bot) return;
  ircClient.say(channel, `<${message.author.username}> ${message.content}`);
});

Both projects aim to bridge chat platforms, but Matterbridge offers a more comprehensive solution with support for multiple services. Discord-IRC focuses specifically on connecting Discord and IRC, which may be simpler for users with more limited needs. Matterbridge's code structure reflects its multi-platform approach, while Discord-IRC's code is more straightforward due to its narrower focus. The choice between the two depends on the specific requirements of the user and the desired level of complexity in setup and maintenance.

2,255

A modern IRC server (daemon/ircd) written in Go.

Pros of Ergo

  • Full-featured IRC server implementation, offering more control and customization
  • Built with modern Go, potentially providing better performance and concurrency
  • Supports advanced IRC features like IRCv3 capabilities and services

Cons of Ergo

  • Requires more setup and configuration compared to Discord-IRC
  • May have a steeper learning curve for users unfamiliar with IRC server administration
  • Limited to IRC protocol, while Discord-IRC bridges two different platforms

Code Comparison

Discord-IRC (JavaScript):

const config = {
  nickname: 'Discord-IRC',
  server: 'irc.example.com',
  discordToken: 'your-token-here',
  channels: [
    { discord: 'discord-channel-id', irc: '#irc-channel' }
  ]
};

Ergo (Go):

ServerConfig:
    Name: My IRC Server
    Network: MyNetwork
    Listeners:
        ":6667":
            TLS: false
        ":6697":
            TLS: true
            Cert: cert.pem
            Key: key.pem

The code snippets demonstrate configuration differences. Discord-IRC focuses on bridging Discord and IRC, while Ergo configures a standalone IRC server with more detailed options for networking and security.

Ergo provides a more comprehensive IRC solution but requires more setup. Discord-IRC offers an easier way to connect Discord and IRC communities but with less customization. The choice depends on specific needs and technical expertise.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Coverage Status

Connects Discord and IRC channels by sending messages back and forth.

Example

discord-irc

Installation and usage

Note: discord-irc requires Node.js version 12 or newer, as it depends on discord.js. Future versions may require newer Node.js versions, though we should support active releases.

Before you can run discord-irc you need to create a configuration file by following the instructions here. After you've done that you can replace /path/to/config.json in the commands below with the path to your newly created configuration file - or just config.json if it's in the same directory as the one you're starting the bot from.

When you've done that you can install and start the bot either through npm:

$ npm install -g discord-irc
$ discord-irc --config /path/to/config.json

or by cloning the repository:

In the repository folder:
$ npm install
$ npm run build
$ npm start -- --config /path/to/config.json # Note the extra double dash

It can also be used as a module:

import discordIRC from 'discord-irc';
import config from './config.json';
discordIRC(config);

Docker

As an alternative to running discord-irc directly on your machine, we provide a Docker container image. After creating a configuration file, you can fetch the image from Docker Hub and run it with the following command:

docker run -v /path/to/config:/config/config.json discordirc/discord-irc

If you've checked out the repository already, you can build the Docker image locally and run that instead:

docker build -t discord-irc .
docker run -v /path/to/config:/config/config.json discord-irc

Note that the path to the config file on the host (/path/to/config) must be a valid absolute path to a config file. Otherwise, you may get the error "illegal operation on a directory".

Configuration

First you need to create a Discord bot user, which you can do by following the instructions here.

Example configuration

[
  // Bot 1 (minimal configuration):
  {
    "nickname": "test2",
    "server": "irc.testbot.org",
    "discordToken": "botwantsin123",
    "channelMapping": {
      "#other-discord": "#new-irc-channel"
    }
  },

  // Bot 2 (advanced options):
  {
    "nickname": "test",
    "server": "irc.bottest.org",
    "discordToken": "botwantsin123",
    "autoSendCommands": [ // Commands that will be sent on connect
      ["PRIVMSG", "NickServ", "IDENTIFY password"],
      ["MODE", "test", "+x"],
      ["AUTH", "test", "password"]
    ],
    "channelMapping": { // Maps each Discord-channel to an IRC-channel, used to direct messages to the correct place
      "#discord": "#irc channel-password", // Add channel keys after the channel name
      "1234567890": "#channel" // Use a discord channel ID instead of its name (so you can rename it or to disambiguate)
    },
    "ircOptions": { // Optional node-irc options
      "floodProtection": false, // On by default
      "floodProtectionDelay": 1000, // 500 by default
      "port": "6697", // 6697 by default
      "secure": true, // enable SSL, false by default
      "sasl": true, // false by default
      "username": "test", // nodeirc by default
      "password": "p455w0rd" // empty by default
    },
    "format": { // Optional custom formatting options
      // Patterns, represented by {$patternName}, are replaced when sending messages
      "commandPrelude": "Command sent by {$nickname}", // Message sent before a command
      "ircText": "<{$displayUsername}> {$text}", // When sending a message to IRC
      "urlAttachment": "<{$displayUsername}> {$attachmentURL}", // When sending a Discord attachment to IRC
      "discord": "**<{$author}>** {$withMentions}", // When sending a message to Discord
      // Other patterns that can be used:
      // {$discordChannel} (e.g. #general)
      // {$ircChannel} (e.g. #irc)
      "webhookAvatarURL": "https://robohash.org/{$nickname}" // Default avatar to use for webhook messages
    },
    "ircNickColor": false, // Gives usernames a color in IRC for better readability (on by default)
    "ircNickColors": ['light_blue', 'dark_blue', 'light_red', 'dark_red', 'light_green', 'dark_green', 'magenta', 'light_magenta', 'orange', 'yellow', 'cyan', 'light_cyan'], // Which irc-upd colors to use
    "parallelPingFix": true, // Prevents users of both IRC and Discord from being mentioned in IRC when they speak in Discord (off by default)
    // Makes the bot hide the username prefix for messages that start
    // with one of these characters (commands):
    "commandCharacters": ["!", "."],
    "ircStatusNotices": true, // Enables notifications in Discord when people join/part in the relevant IRC channel
    "ignoreUsers": {
      "irc": ["irc_nick1", "irc_nick2"], // Ignore specified IRC nicks and do not send their messages to Discord.
      "discord": ["discord_nick1", "discord_nick2"], // Ignore specified Discord nicks and do not send their messages to IRC.
      "discordIds": ["198528216523210752"] // Ignore specified Discord ids and do not send their messages to IRC.
    },
    // List of webhooks per channel
    "webhooks": {
      "#discord": "https://discord.com/api/webhooks/id/token"
    }
  }
]

The ircOptions object is passed directly to irc-upd (available options).

To retrieve a discord channel ID, write \#channel on the relevant server – it should produce something of the form <#1234567890>, which you can then use in the channelMapping config.

Webhooks

Webhooks lets you override nicknames and avatars, so messages coming from IRC can appear as regular Discord messages:

discord-webhook

To enable webhooks, follow part 1 of this guide to create and retrieve a webhook URL for a specific channel, then enable it in discord-irc's config as follows:

  "webhooks": {
    "#discord-channel": "https://discord.com/api/webhooks/id/token"
  }

Encodings

If you encounter trouble with some characters being corrupted from some clients (particularly umlauted characters, such as ä or ö), try installing the optional dependencies iconv and node-icu-charset-detector. The bot will produce a warning when started if the IRC library is unable to convert between encodings.

Further information can be found in the installation section of irc-upd.

Tests

Run the tests with:

$ npm test

Style Guide

discord-irc follows the Airbnb Style Guide. ESLint is used to make sure this is followed correctly, which can be run with:

$ npm run lint

NPM DownloadsLast 30 Days