Skip to content

feat: Add IRC channel integration #1137

@amirmamaghani

Description

@amirmamaghani

Summary

Add IRC as a new picoclaw channel (pkg/channels/irc/), enabling bots to connect to IRC servers, join channels, respond to mentions, and handle DMs.

Motivation

IRC remains widely used in open-source, DevOps, and technical communities. Adding IRC support would let picoclaw bots serve users on Libera.Chat, OFTC, private IRC networks, and self-hosted servers (Ergo, UnrealIRCd, etc.) alongside existing channels like Discord, Telegram, and Slack.

Proposed Design

Follow the existing channel pattern (embed BaseChannel, implement Channel interface, register via init() factory).

Config

{
  "channels": {
    "irc": {
      "enabled": true,
      "server": "irc.libera.chat:6697",
      "tls": true,
      "nick": "mybot",
      "password": "",
      "nickserv_password": "",
      "sasl_user": "",
      "sasl_password": "",
      "channels": ["#mychannel"],
      "allow_from": [],
      "group_trigger": { "mention_only": true }
    }
  }
}

Library

github.com/ergochat/irc-go — specifically ircevent for connection management, reconnection, PING/PONG keepalive, and SASL. Maintained by the Ergo IRC server team.

Key behaviors

  • Auth: SASL > NickServ > server password (in priority order)
  • Inbound: PRIVMSG events → parse nick/target/content → DM vs channel → mention detection → HandleMessage
  • Outbound: conn.Privmsg(target, line) — split on newlines, respect 512-byte IRC line limit via WithMaxMessageLength(400)
  • Reconnection: Handled by ircevent.Connection.Loop() with built-in backoff
  • Mention detection: nick: / nick, prefix (standard IRC convention) + word-boundary match. Uses conn.CurrentNick() to handle nick collisions
  • Rate limiting: "irc": 2 in channelRateConfig (~2 msg/sec, safe for most networks)

Not implemented

IRC doesn't support typing indicators, message editing, placeholders, streaming, reactions, or media uploads — so none of the optional capability interfaces apply.

Files

Action File
Modify pkg/config/config.go — add IRCConfig struct + field to ChannelsConfig
Modify pkg/channels/manager.go — add rate config + initChannel block
Modify cmd/picoclaw/internal/gateway/helpers.go — add blank import
Create pkg/channels/irc/init.go — factory registration
Create pkg/channels/irc/irc.go — struct, constructor, Start/Stop/Send
Create pkg/channels/irc/handler.go — PRIVMSG handler, mention helpers

Happy to submit a PR for this if there's interest.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions