Class: Discorb::Gateway::MessagePinEvent

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

Overview

Represents a message pin event.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from GatewayEvent

#inspect

Constructor Details

#initialize(client, data, message) ⇒ MessagePinEvent

Returns a new instance of MessagePinEvent.



534
535
536
537
538
539
540
541
542
543
544
545
546
# File 'lib/discorb/gateway_events.rb', line 534

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

#messageDiscorb::Message (readonly)

Returns The message that was pinned.

Returns:



525
526
527
# File 'lib/discorb/gateway_events.rb', line 525

def message
  @message
end

#pinned?Boolean (readonly)

Returns Whether the message was pinned.

Returns:

  • (Boolean)

    Whether the message was pinned.



534
535
536
537
538
539
540
541
542
543
544
545
546
# File 'lib/discorb/gateway_events.rb', line 534

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.



527
528
529
# File 'lib/discorb/gateway_events.rb', line 527

def type
  @type
end

#unpinned?Boolean (readonly)

Returns Whether the message was unpinned.

Returns:

  • (Boolean)

    Whether the message was unpinned.



534
535
536
537
538
539
540
541
542
543
544
545
546
# File 'lib/discorb/gateway_events.rb', line 534

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