lib/cogbot.rb in cogbot-0.1.7 vs lib/cogbot.rb in cogbot-0.1.9

- old
+ new

@@ -4,29 +4,29 @@ require 'nokogiri' require 'net/http' require 'daemons' require 'thor' require 'yajl' -require "lib/cogbot/utils" -require "lib/cogbot/server" +require 'lib/cogbot/utils' +require 'lib/cogbot/server' # main cogbot module module Cogbot # cogbot cli parser and launcher class Bot < Thor - desc "start", "start cogbot" + desc 'start', 'start cogbot' # manages the start cli command def start # prepare config config = {} begin config = YAML::load_file(CONFIG_FILE) rescue Exception => e - load "lib/cogbot/setup.rb" + load 'lib/cogbot/setup.rb' config['main'] = Cogbot::Setup.init end # prepare daemon Daemons.daemonize( @@ -59,11 +59,11 @@ c.sasl.password = config['main']['sasl_pass'] c.options = { 'cogconf' => config } c.plugins.prefix = config['main']['prefix'] c.plugins.plugins = plugins end - on :message, "hi" do |m| + on :message, 'hi' do |m| m.reply "Hello, #{m.user.nick}" end end bot.loggers.debug(plugins.inspect) @@ -84,18 +84,18 @@ end bot.quit end - desc "stop", "stop cogbot" + desc 'stop', 'stop cogbot' # manages the stop cli command def stop pid_file = File.join(CONFIG_DIR, 'cogbot.pid') pid = File.read(pid_file).to_i if File.exist?(pid_file) Process.kill('TERM', pid) end - desc "restart", "restart cogbot" + desc 'restart', 'restart cogbot' # manages the restart cli command, just stopping and startinbg in sequence def restart stop start end