Class: Discorb::GatewayHandler::ReactionRemoveEmojiEvent

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

Overview

Represents a MESSAGE_REACTION_REMOVE_EMOJI event.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#channel -> nil, Discorb::Channel (readonly)

Note:

This method returns an object from client cache. it will return nil if the object is not in cache.

Returns:

  • (nil)

    The object wasn't cached.

  • (Discorb::Channel)

    The channel the message was sent in.



161
162
163
# File 'lib/discorb/gateway.rb', line 161

def channel
  @channel
end

#channel_id -> Discorb::Snowflake (readonly)

Returns The ID of the channel the message was sent in.

Returns:



154
155
156
# File 'lib/discorb/gateway.rb', line 154

def channel_id
  @channel_id
end

#emoji -> Discorb::UnicodeEmoji, Discorb::PartialEmoji (readonly)

Returns The emoji that was reacted with.

Returns:



169
170
171
# File 'lib/discorb/gateway.rb', line 169

def emoji
  @emoji
end

#guild -> nil, Discorb::Guild (readonly)

Note:

This method returns an object from client cache. it will return nil if the object is not in cache.

Returns:

  • (nil)

    The object wasn't cached.

  • (Discorb::Guild)

    The guild the message was sent in.



164
165
166
# File 'lib/discorb/gateway.rb', line 164

def guild
  @guild
end

#guild_id -> Discorb::Snowflake (readonly)

Returns The ID of the guild the message was sent in.

Returns:



158
159
160
# File 'lib/discorb/gateway.rb', line 158

def guild_id
  @guild_id
end

#message -> nil, Discorb::Message (readonly)

Note:

This method returns an object from client cache. it will return nil if the object is not in cache.

Returns:

  • (nil)

    The object wasn't cached.

  • (Discorb::Message)

    The message the reaction was sent in.



167
168
169
# File 'lib/discorb/gateway.rb', line 167

def message
  @message
end

#message_id -> Discorb::Snowflake (readonly)

Returns The ID of the message.

Returns:



156
157
158
# File 'lib/discorb/gateway.rb', line 156

def message_id
  @message_id
end

Instance Method Details

#fetch_message(force: false) -> Discorb::Message

Note:

This is an asynchronous method, it will return a Async::Task object. Use Async::Task#wait to get the result.

Note:

This method calls HTTP request.

Fetch the message. If message is cached, it will be returned.

Parameters:

  • force (Boolean) (defaults to: false)

    Whether to force fetching the message.

Returns:

Raises:



192
193
194
195
196
197
198
# File 'lib/discorb/gateway.rb', line 192

def fetch_message(force: false)
  Async do |_task|
    next @message if !force && @message

    @message = @channel.fetch_message(@message_id).wait
  end
end