Module: Discorb::Extension Abstract
- Defined in:
- lib/discorb/extension.rb
Overview
This module is abstract.
Abstract class to make extension. Include from this module to make your own extension.
Instance Method Summary collapse
Instance Method Details
#events -> Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/discorb/extension.rb', line 15 def events return @events if @events ret = {} self.class.events.each do |event, handlers| ret[event] = handlers.map do |handler| Discorb::EventHandler.new(proc { |*args, **kwargs| instance_exec(*args, **kwargs, &handler[2]) }, handler[0], handler[1]) end end @events = ret end |
#initialize(client) -> Object
11 12 13 |
# File 'lib/discorb/extension.rb', line 11 def initialize(client) @client = client end |