kqtran

discord-irc as twitch chat bridge

·

This is how to set up a bridge between a Discord channel and twitch chat. Entering messages in one will show up in the other and vice-versa. I'm not sure why anyone would ever use this other than me at all, but here's how to do it. Use cases are: fewer applications open when streaming, no need to use obs chat interface, historical reference for chat, etc.

Install discord-irc

discord-irc

$ npm install -g discord-irc`

$ discord-irc --config /path/to/config.json

Create a Discord bot

Creating a discord bot & getting a token The /#channel command specified in the article does not work - instead, you can right click the channel and select Copy ID for the channel ID. This will be referred to as $discord_channel_id. The token retrieved from the article will be referred to as $discord_token.

Create a Twitch account

The Discord bot will be present on the Discord channel, capturing messages to send to the Twitch account to post to the Twitch channel and vice-versa.

Create configuration

    "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)
    }

full configuration:

1 {
2 "nickname": "$twitch_username",
3 "server": "irc.chat.twitch.tv",
4 "discordToken": "$discord_token",
5 "channelMapping": {
6 "#twitch_channel_name": "$discord_channel_id",
7 "$discord_channel_id": "#twitch_channel_name"
8 },
9 "ircOptions": {
10 "retryDelay": "120",
11 "username": "$twitch_username",
12 "password": "$oauth_password",
13 "nick": "$twitch_username"
14 },
15 "ircNickColor": false,
16 }

Pay close attention to the $ or # - $ implies a variable to be replaced, but # is the prefix used for the IRC channel.

$twitch_username = username of the Twitch bot that will post messages to Twitch chat.

$discord_token = token for the Discord bot that will post messages to the Discord channel.

#twitch_channel_name = name of the channel to post twitch chat messages to

$oauth_password = oauth password, including the oauth: prefix.

ircNickColor - more on this later - to set up matching colors