disirc is a Discord-IRC bridge daemon. It connects to UnrealIRCd as a peer server. It presents each Discord user as a real IRC pseudoclient.
This was almost entirely implemented by Claude, just to see what all the fuss is about. I have attempted to get it to correct it's most ridiculous mistakes, but I make no promises that any of this works (or that the docs match reality.)
disirc links to an UnrealIRCd network with the server-to-server (S2S) protocol. Each online Discord user in a bridged channel gets one IRC pseudoclient. The pseudoclient has a real nick, a real ident, and a real hostname. From the IRC side, a Discord user looks like an ordinary IRC user.
IRC network Discord
| |
| S2S link | Gateway
| |
+-- disirc (pseudo-server) ----------+
| | |
| +-- Alice (pseudoclient) +-- Alice (Discord user)
| +-- Bob (pseudoclient) +-- Bob (Discord user)
| |
+-- real IRC users +-- other Discord users
Messages travel in both directions:
- Discord to IRC: disirc sends each Discord message as a PRIVMSG from the pseudoclient of the sender. Other IRC users see a regular channel message.
- IRC to Discord: disirc forwards each IRC message to the mapped Discord channel. It uses a webhook, which gives each IRC user a separate username. If the channel has no webhook, disirc sends a bot message with a
**[nick]**prefix.
- Pseudoclient model — Each Discord user appears as a real IRC user. Nicks, joins, quits, and presence (away and back) all work.
- Message relay in both directions — disirc bridges channel messages, notices, and actions (
/me). - Webhook support — Each IRC user appears in Discord under their own nick, because disirc sets the webhook username. Every user therefore keeps a separate visual identity.
- Formatting conversion — disirc converts Discord markdown to IRC control codes. It converts IRC control codes back to Discord markdown. This covers bold, italic, underline, code, and strikethrough.
- Mention resolution — disirc converts Discord
<@user>,<#channel>, and<@&role>mentions to readable names on IRC. It converts IRC@nickto a Discord mention. It also converts a leadingnick:, which is the usual way to address a user on IRC. - DM bridging (you must enable it) — disirc forwards an IRC
/msgto a pseudoclient as a Discord DM. It relays a Discord DM back to the addressed IRC user. The addressed user comes from the reply context or from a leadingnick:. - Automatic reconnection — If the S2S link fails, disirc reconnects. It uses exponential backoff with jitter. It keeps the pseudoclient state, so the next burst is immediate.
- Configuration reload — You can add or remove a bridge mapping without a restart. Send SIGHUP, or use the control channel.
- Safety — disirc suppresses
@everyoneand@hereon every IRC-to-Discord path. It also inserts a zero-width space into IRC nicks, which stops Discord from sending a highlight.
- UnrealIRCd 6.x — disirc uses the UnrealIRCd S2S protocol. It does not support other IRC daemons, such as InspIRCd or charybdis.
- Discord bot account — You must enable the Server Members, Message Content, and Presence privileged intents.
- Rust (stable) — to build from source.
-
Clone and build:
git clone https://github.com/JonathanO/disirc.git cd disirc cargo build --release -
Add a link block for the bridge to the UnrealIRCd configuration:
link bridge.example.net { incoming { mask *; }; password "your-link-password"; class servers; hub *; }; -
Create a Discord bot in the Developer Portal:
- Under Bot, enable these privileged gateway intents: Server Members, Message Content, and Presence.
- Copy the bot token.
-
Invite the bot to your Discord server with this OAuth2 URL. Replace
YOUR_CLIENT_IDwith the Application ID from the Developer Portal:https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot&permissions=536874048This URL grants these permissions: View Channels, Send Messages, Read Message History, and Manage Webhooks.
-
Copy and edit the configuration:
cp config.example.toml config.toml
Enter your Discord bot token, the IRC uplink address, the link password, the SID, and the channel mappings. The comments in
config.example.tomldescribe each field. -
Run disirc:
cargo run --release
To include debug logs:
RUST_LOG=disirc=debug cargo run --release
config.example.toml lists every option with comments. These are the main sections:
[discord]— the bot token[irc]— the uplink address, the link credentials, and the SID[pseudoclients]— the ident, DM bridging, and KILL reintroduction[formatting]— the conversion of a leadingnick:to a mention[[bridge]]— one entry for each pair of Discord and IRC channels, with an optional webhook URL
Run disirc under a process supervisor that restarts it. Use systemd with
Restart=always, a Docker --restart=unless-stopped policy, or an equivalent.
If disirc reaches a state it cannot recover from, it exits. It does not continue with corrupt data. There is one such state today: the UID space is exhausted.
disirc allocates each pseudoclient UID from a per-process counter of 36^6 suffixes. If the counter passes that limit, the suffix wraps. disirc would then reissue a UID that belongs to a live pseudoclient. Two Discord users would share one IRC identity, and disirc would attribute their messages to the wrong person. disirc aborts instead. The counter is per-process, so a restart clears it.
To reach the limit, disirc must allocate 2,176,782,336 distinct UIDs in one process lifetime. This is a safety net, not an expected event.
Pseudoclient state survives a restart. disirc stores the channel memberships and
the activity timestamps in the state file that pseudoclients.state_file names.
DEVELOPING.md describes the development setup, the tests, and how to run UnrealIRCd in Docker.
MIT