lib/cogbot.rb in cogbot-0.1.2 vs lib/cogbot.rb in cogbot-0.1.3

- old
+ new

@@ -4,20 +4,22 @@ require 'nokogiri' require 'net/http' require 'daemons' require 'thor' require 'yajl' -#require 'cinch/storage/yaml' require "lib/cogbot/version" 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" + # manages the start cli command def start # prepare config config = {} begin @@ -58,13 +60,10 @@ c.realname = config['main']['nick'] c.channels = config['main']['channels'] c.options = { 'cogconf' => config } c.plugins.prefix = config['main']['prefix'] c.plugins.plugins = plugins - #c.storage.backend = Cinch::Storage::YAML - #c.storage.basedir = File.join(ROOT_DIR,"yaml") - #c.storage.autosave = true end on :message, "hi" do |m| m.reply "Hello, #{m.user.nick}" end end @@ -88,16 +87,18 @@ bot.quit end desc "stop", "stop cogbot" + # manages the stop cli command def stop pid_file = File.join('/', 'tmp', 'cogbot.pid') pid = File.read(pid_file).to_i if File.exist?(pid_file) Process.kill('TERM', pid) end desc "restart", "restart cogbot" + # manages the restart cli command, just stopping and startinbg in sequence def restart stop start end