Skip to content

Instantly share code, notes, and snippets.

@tribixbite
Last active August 14, 2021 04:09
Show Gist options
  • Select an option

  • Save tribixbite/f0ccbb736e902234741f43e3c3215091 to your computer and use it in GitHub Desktop.

Select an option

Save tribixbite/f0ccbb736e902234741f43e3c3215091 to your computer and use it in GitHub Desktop.
discord-irc bridge
  1. Download and install NodeJS here (recommended: use choco)
  2. Open a terminal and install the bridge with the command:
  3. npm install -g discord-irc
  4. Create a new discord server, then in #general send the command: \#general and note the number between the carrots. You'll use it in step 7 (TYPEYOURDISCORDCHANNELIDHERE).
  5. Create a webhook for your server and save the URL for use in step 7 by following this guide.
  6. Create a discord bot user by following this guide and save the token (TYPEYOURDISCORDTOKENHERE).
  7. Create a folder somewhere (eg C:\discordirc) and create a file called 'config.json', using any text editor, (vscode recommended) paste and save the code below these steps into it (change the 5 uppercase values).
  8. Create a bridge.bat file in the same folder, and using a text editor paste and save the following:
  9. discord-irc --config config.json
  10. Open a new file explorer and in the address bar type shell:startup and press enter. Right click and drag your bridge.bat file into this startup folder and click 'create a shortcut'. Run it by double clicking. (It will automatically start on subsequent reboots). Done!
  11. If you run into trouble check the official documentation here or message tribixbite#9650 on discord.
  // Bot 1 (minimal configuration):
  {
    "nickname": "TYPEYOURREGISTEREDNICKNAMEHERE",
    "server": "irc.libera.chat",
    "discordToken": "TYPEYOURDISCORDTOKENHERE",
    "channelMapping": {
      "TYPEYOURDISCORDCHANNELIDHERE": "##flashlight"
    },
    "autoSendCommands": [ // Commands that will be sent on connect
      ["PRIVMSG", "NickServ", "IDENTIFY TYPEYOURPASSWORDHERE"]
    ],
    "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": "TYPEYOURNICKHERE" // nodeirc by default
    },
    "format": { // Optional custom formatting options
      // Patterns, represented by {$patternName}, are replaced when sending messages
      "commandPrelude": false, // Message sent before a command
      "ircText": "{$text}", // When sending a message to IRC <{$displayUsername}> 
      "urlAttachment": "{$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)
    "parallelPingFix": true, // Prevents users of both IRC and Discord from being mentioned in IRC when they speak in Discord (off by default)
    "ircStatusNotices": true// Enables notifications in Discord when people join/part in the relevant IRC channel
  }
]```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment