require 'cinch' require 'ircstring' require 'bitbot/database' require 'bitbot/plugin/common' require 'bitbot/plugin/help' require 'bitbot/plugin/balance' require 'bitbot/plugin/deposit' require 'bitbot/plugin/history' require 'bitbot/plugin/tip' require 'bitbot/plugin/tipstats' require 'bitbot/plugin/withdraw' require 'bitbot/plugin/update_addresses' require 'bitbot/plugin/update_exchange_rates' require 'bitbot/plugin/txfee' require 'bitbot/plugin/doc' require 'bitbot/plugin/online' require 'bitbot/plugin/prize' class Bitbot::Plugin include Cinch::Plugin include Bitbot::Common include Bitbot::Help include Bitbot::Balance include Bitbot::Deposit include Bitbot::History include Bitbot::Tip include Bitbot::TipStats include Bitbot::Withdraw include Bitbot::UpdateAddresses include Bitbot::UpdateExchangeRates include Bitbot::Txfee include Bitbot::Doc include Bitbot::Online include Bitbot::Prize def initialize(bot) super Bitbot::Database.new(File.join(config['data']['path'], "bitbot.db")).upgrade_schema() end set :prefix, "" # # Private messages # match /^help(.*)$/, :method => :on_help, :react_on => :private match /^balance$/, :method => :on_balance, :react_on => :private match /^history$/, :method => :on_history, :react_on => :private match /^withdraw(.*)$/, :method => :on_withdraw, :react_on => :private match /^deposit$/, :method => :on_deposit, :react_on => :private match /^\+tip\s+(\w+)\s+([\d.]+)\s+?(.*)/, :method => :on_tip, :react_on => :private # # Channel messages # match /^\+help(.*)$/, :method => :on_help, :react_on => :channel match /^\+tipstats$/, :method => :on_tipstats, :react_on => :channel match /^\+tip\s+(\w+)\s+([\d.]+)\s+?(.*)/, :method => :on_tip, :react_on => :channel match /^\+doc$/, :method => :on_tipstats, :react_on => :channel match /^\+ticker$/, :method => :on_tipstats, :react_on => :channel # # Timer jobs # timer 60, :method => :on_update_exchange_rates timer 60, :method => :on_update_addresses timer 10, :method => :on_prize_win_check_balance # # Also run the timer jobs on connect # listen_to :connect, :method => :on_update_exchange_rates listen_to :connect, :method => :on_update_addresses listen_to :connect, :method => :on_online listen_to :connect, :method => :on_doc # # Run these jobs on every channel message # listen_to :channel, :method => :on_prize end