2013-05-29 14:46:16 +00:00
|
|
|
#!env ruby
|
|
|
|
|
|
|
|
require 'rubygems'
|
|
|
|
require 'eventmachine'
|
|
|
|
require 'em-irc'
|
2013-05-29 18:55:52 +00:00
|
|
|
require_relative 'config'
|
|
|
|
require_relative 'repost'
|
2013-05-29 14:46:16 +00:00
|
|
|
|
|
|
|
repost = Repost.new do
|
|
|
|
|
|
|
|
host Config[:server][:host]
|
|
|
|
port Config[:server][:port]
|
|
|
|
|
|
|
|
on :connect do
|
|
|
|
puts "connected! changing nick to #{Config[:client][:nick]}"
|
|
|
|
nick Config[:client][:nick]
|
|
|
|
end
|
|
|
|
|
|
|
|
on :nick do
|
|
|
|
Config[:client][:channels].each do |channel|
|
|
|
|
puts "joining #{channel}"
|
|
|
|
join channel
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
on :raw do |message|
|
|
|
|
self.dispatch_raw_message message
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-05-29 18:55:52 +00:00
|
|
|
Config[:plugins].each do |plugin|
|
|
|
|
puts "Loading plugin #{plugin}"
|
|
|
|
eval File.read(File.dirname($0) + "/plugins/#{plugin}.rb")
|
|
|
|
end if not Config[:plugins].nil?
|
2013-05-29 14:46:16 +00:00
|
|
|
|
|
|
|
repost.run!
|