require "forwardable" module Boty class ScriptDSL attr_accessor :bot INSTANCES = {} private_constant :INSTANCES class << self alias original_constructor new end extend Forwardable def_delegators :bot, :desc, :respond, :name, :say, :im, :brain, :know_how def initialize(bot) @bot = bot end def self.new(bot) INSTANCES[bot] ||= original_constructor bot end end end