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 ~ replies sent via PRIVMSG # 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 /^ping$/, :method => :on_ping, :react_on => :private # match /^\+prize\s+(\w+)\s+([\d.]+)\s+?(.*)/, :method => :on_prize, :react_on => :private # # Private messages ~ replies sent via channel # match /^\+tip\s+(\w+)\s+([\d.]+)\s+?(.*)/, :method => :on_tip, :react_on => :channel # # Channel messages ~ replies sent via channel # 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_doc, :react_on => :channel match /^\+ticker$/, :method => :on_ticker, :react_on => :channel match /^\+txfee$/, :method => :on_txfee, :react_on => :channel match /^\+version$/, :method => :on_version, :react_on => :channel # # Channel messages ~ replies sent via PRIVMSG # match /^\+balance$/, :method => :on_balance, :react_on => :private match /^\+help$/, :method => :on_help, :react_on => :private match /^\+history$/, :method => :on_history, :react_on => :private # # 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 end