Skip to content

Instantly share code, notes, and snippets.

@iande
Created March 15, 2012 19:12
Show Gist options
  • Save iande/2046153 to your computer and use it in GitHub Desktop.
Save iande/2046153 to your computer and use it in GitHub Desktop.
quick test of ircbgb
#!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