A minimal Ruby IRC client.
- Opens a TCP connection to an IRC server
- Registers with
NICK/USER - Joins channels
- Auto-replies to
PINGwithPONG - Prints raw server lines
bin/setupEdit bin/test with your own nick and channel, then:
./bin/testYou should see Libera's welcome / MOTD scroll by, then a JOIN confirmation.
require "ircc"
connection = Ircc::Connection.new(host: "irc.libera.chat", port: 6667)
connection.connect
client = Ircc::Client.new(connection)
client.register(nickname: "mynick", username: "mynick", realname: "Me")
client.join("#some-channel")
loop do
line = client.process_next
break if line.nil?
puts line
end| Piece | Role |
|---|---|
Ircc::Connection |
TCP connect / read / write / close |
Ircc::Command |
Build IRC command strings (NICK, USER, PONG, JOIN) |
Ircc::Client |
Register, join, handle PING, read the next line |
bundle exec rspec
bundle exec rubocop
bin/console