Skip to content

Instantly share code, notes, and snippets.

@bnagy
Created June 26, 2012 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnagy/2994849 to your computer and use it in GitHub Desktop.
Save bnagy/2994849 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require_relative "tabornok/irc"
require_relative "tabornok/logger"
require_relative "tabornok/console"
require "thread"
class Tabornok
def initialize
@logger = Logger.new
@logger.message "Tabornok IRC Bot and Framework"
@logger.message "Copyright (C) 2012 Jackneill"
@logger.message "This program comes with ABSOLUTELY NO WARRANTY; for details type see <http://www.gnu.org/licenses/>."
@logger.message "This is free software, and you are welcome to redistribute it"
@logger.message "under certain conditions; for details type see <http://www.gnu.org/licenses/>."
end
def connect
@irc = Irc.new
@irc.connect "irc.rizon.net", 6667
@irc.auth "Tabornok"
@irc.joinchan "#hun_bot"
@irc.joinchan "#Tabornok"
rescue
@logger.message "Error in #{__method__}: #{$!}"
end
def run
@thread_read_irc = Thread.new { irc.read_irc }
@thread_pinger = Thread.new { irc.pinger }
@console = Console.new
@thread_read_console = Thread.new { console.read_console }
[@read_thread, @ping_thread, @console_thread].map(&:join)
rescue
@logger.message "Error in #{__method__}: #{$!}"
end
end
tabornok = Tabornok.new
tabornok.connect
tabornok.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment