Created
March 15, 2012 19:12
-
-
Save iande/2046153 to your computer and use it in GitHub Desktop.
quick test of ircbgb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!env ruby | |
require 'bundler' | |
Bundler.setup | |
require 'ircbgb' | |
bot = Ircbgb::Client.new do |c| | |
c.servers = 'irc://pinkhair.gudefrends.net' | |
c.nicks = ['iande', 'ian-2', 'ian-3'] | |
c.username = 'iansBot' | |
c.realname = 'I am not a bot!' | |
end | |
bot.received do |m| | |
puts "> [#{m.command}] #{m.source.to_s}: #{m.params.join ' '}" | |
end | |
bot.sent do |m| | |
puts "< #{m.command} #{m.params.join ' '}" | |
end | |
puts "Starting the bot" | |
bot.start | |
trap('INT') do | |
puts "Stopping the bot" | |
bot.stop | |
puts "Done" | |
exit 0 | |
end | |
while true | |
cmd, rest = gets.chomp.split(' ', 2) | |
if cmd | |
bot.__send__ :write_command, cmd, rest | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment