#!/usr/bin/ruby1.9.1
require 'socket'
serv, port, nick, chan = ARGV
bot = TCPSocket.open(serv, port)
bot.puts "USER #{nick} 0 * #{nick}",
"NICK #{nick}"
chan.split.each do |chan| #splits string `chan' to join multiple channels if more than one is given
bot.puts "JOIN #{chan}",
"PRIVMSG #{chan} :Hello, this is #{nick}."
end
until bot.eof? do
puts bot.gets
end
Refactorings
No refactoring yet !
So far this is what i have written for this IRC bot, however I have had trouble extending it to include other features like pinging the server, replying to messages and commands like dice rolling and googling. This is mostly because I don't have very much knowledge of IRC, HTTP and socket programming in general. How can this written to make facilitating features like that, and more, easy to do?