Class: Discordrb::Events::ChannelPinsUpdateEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/discordrb/events/channels.rb

Overview

Raised when a message is pinned or unpinned.

Instance Attribute Summary collapse

Attributes inherited from Event

#bot

Instance Method Summary collapse

Constructor Details

#initialize(data, bot) ⇒ ChannelPinsUpdateEvent

Returns a new instance of ChannelPinsUpdateEvent.



182
183
184
185
186
187
188
# File 'lib/discordrb/events/channels.rb', line 182

def initialize(data, bot)
  @bot = bot

  @server = bot.server(data['guild_id']) if data['guild_id']
  @channel = bot.channel(data['channel_id'])
  @last_pin_timestamp = Time.iso8601(data['last_pin_timestamp']) if data['last_pin_timestamp']
end

Instance Attribute Details

#channelChannel (readonly)

Returns The channel this event originates from.

Returns:

  • (Channel)

    The channel this event originates from.



177
178
179
# File 'lib/discordrb/events/channels.rb', line 177

def channel
  @channel
end

#last_pin_timestampTime? (readonly)

Returns Time at which the most recent pinned message was pinned.

Returns:

  • (Time, nil)

    Time at which the most recent pinned message was pinned.



174
175
176
# File 'lib/discordrb/events/channels.rb', line 174

def last_pin_timestamp
  @last_pin_timestamp
end

#serverServer? (readonly)

Returns The server this event originates from.

Returns:

  • (Server, nil)

    The server this event originates from.



180
181
182
# File 'lib/discordrb/events/channels.rb', line 180

def server
  @server
end