Class: Discorb::Gateway::MessagePinEvent

Inherits:
GatewayEvent show all
Defined in:
lib/discorb/gateway.rb

Overview

Represents a message pin event.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, data, message) -> MessagePinEvent

Returns a new instance of MessagePinEvent.



407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/discorb/gateway.rb', line 407

def initialize(client, data, message)
  @client = client
  @data = data
  @message = message
  @type = if message.nil?
      :unknown
    elsif @message.pinned?
      :pinned
    else
      :unpinned
    end
end

Instance Attribute Details

#message -> Discorb::Message (readonly)

Returns The message that was pinned.

Returns:



398
399
400
# File 'lib/discorb/gateway.rb', line 398

def message
  @message
end

#pinned? -> Boolean (readonly)

Returns Whether the message was pinned.

Returns:

  • (Boolean)

    Whether the message was pinned.



407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/discorb/gateway.rb', line 407

def initialize(client, data, message)
  @client = client
  @data = data
  @message = message
  @type = if message.nil?
      :unknown
    elsif @message.pinned?
      :pinned
    else
      :unpinned
    end
end

#type -> :pinned, :unpinned (readonly)

Returns The type of event.

Returns:

  • (:pinned, :unpinned)

    The type of event.



400
401
402
# File 'lib/discorb/gateway.rb', line 400

def type
  @type
end

#unpinned? -> Boolean (readonly)

Returns Whether the message was unpinned.

Returns:

  • (Boolean)

    Whether the message was unpinned.



407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/discorb/gateway.rb', line 407

def initialize(client, data, message)
  @client = client
  @data = data
  @message = message
  @type = if message.nil?
      :unknown
    elsif @message.pinned?
      :pinned
    else
      :unpinned
    end
end