require "forwardable" module Boty class DSL include Boty::Logger INSTANCES = {} private_constant :INSTANCES class << self alias_method :original_constructor, :new end attr_accessor :bot extend Forwardable def_delegators :bot, :desc, :respond, :name, :brain, :know_how, :im, :say, :match def_delegators :message, :user, :channel def self.new(bot) INSTANCES[bot] ||= original_constructor bot end def initialize(bot) @bot = bot end def message @bot.trigger_message end def message_from_me? message.from? @bot end def hear(*args, &block) match(*args, &block) end def command(*args, &block) respond(*args, &block) end def match_im(*args, &block) command(*args, &block) end def http @http ||= Boty::HTTP.new end end end