class Discorb::Gateway::ReactionRemoveEmojiEvent

Represents a `MESSAGE_REACTION_REMOVE_EMOJI` event.

Attributes

channel[R]

@macro client_cache @return [Discorb::Channel] The channel the message was sent in.

channel_id[R]

@return [Discorb::Snowflake] The ID of the channel the message was sent in.

emoji[R]

@return [Discorb::UnicodeEmoji, Discorb::PartialEmoji] The emoji that was reacted with.

guild[R]

@macro client_cache @return [Discorb::Guild] The guild the message was sent in.

guild_id[R]

@return [Discorb::Snowflake] The ID of the guild the message was sent in.

message[R]

@macro client_cache @return [Discorb::Message] The message the reaction was sent in.

message_id[R]

@return [Discorb::Snowflake] The ID of the message.

Public Class Methods

new(client, data) click to toggle source

@!visibility private

# File lib/discorb/gateway.rb, line 175
def initialize(client, data)
  @client = client
  @data = data
  @guild_id = Snowflake.new(data[:guild_id])
  @channel_id = Snowflake.new(data[:channel_id])
  @message_id = Snowflake.new(data[:message_id])
  @guild = client.guilds[data[:guild_id]]
  @channel = client.channels[data[:channel_id]]
  @message = client.messages[data[:message_id]]
  @emoji = data[:emoji][:id].nil? ? DiscordEmoji.new(data[:emoji][:name]) : PartialEmoji.new(data[:emoji])
end

Public Instance Methods

fetch_message(force: false) click to toggle source

Fetch the message. If message is cached, it will be returned. @macro async @macro http

@param [Boolean] force Whether to force fetching the message.

@return [Discorb::Message] The message.

# File lib/discorb/gateway.rb, line 195
def fetch_message(force: false)
  Async do
    next @message if !force && @message

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