class Discorb::Event

Represents a event. This class shouldn't be instantiated directly. Use {Client#on} instead.

Attributes

block[R]

@return [Proc] the block to be called.

discriminator[R]

@return [Hash] the event discriminator.

id[R]

@return [Symbol] the event id.

once[R]

@return [Boolean] whether the event is once or not.

once?[R]

@return [Boolean] whether the event is once or not.

Public Class Methods

new(block, id, discriminator) click to toggle source
# File lib/discorb/event.rb, line 20
def initialize(block, id, discriminator)
  @block = block
  @id = id
  @once = discriminator.fetch(:once, false)
  @discriminator = discriminator
  @rescue = nil
end

Public Instance Methods

call(...) click to toggle source

Calls the block associated with the event.

# File lib/discorb/event.rb, line 31
def call(...)
  @block.call(...)
end