Sha256: 461e8cd2a3fb5b18fd63311241dbdb99bf32f4c0b6cf4798693e6cf89bb53aba
Contents?: true
Size: 1.28 KB
Versions: 11
Compression:
Stored size: 1.28 KB
Contents
#!/usr/bin/env ruby require 'daemons' require 'yaml' require 'bitbot/plugin' def usage puts "Usage: #{File.basename($0)} {start|stop|run} <path to config.yml>" exit 1 end if ARGV.length < 2 usage() end config_file = File.expand_path(ARGV.pop) unless File.exist?(config_file) usage() end config = YAML::load(File.open(config_file)) unless File.exist?(File.dirname(config['data']['path'])) puts "Data directory does not exist: #{File.dirname(config['data']['path'])}" exit 1 end Daemons.run_proc(config['daemon_name'] || 'bitbot', :hard_exit => true, :backtrace => true, :ontop => false, :multiple => false, :monitor => true, :log_output => true) do bot = Cinch::Bot.new do configure do |c| c.server = config['irc']['server'] c.port = config['irc']['port'] c.ssl.use = config['irc']['ssl'] c.channels = config['irc']['channels'] c.nick = config['irc']['nick'] || 'bitbot' c.user = config['irc']['username'] || 'bitbot' c.password = config['irc']['password'] c.verbose = config['irc']['verbose'] c.plugins.plugins = [Bitbot::Plugin] c.plugins.options[Bitbot::Plugin] = config end end bot.start end
Version data entries
11 entries across 11 versions & 2 rubygems