Class: Discorb::Gateway::ReactionEvent

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

Overview

Represents a reaction event.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from GatewayEvent

#inspect

Instance Attribute Details

#channelnil, Discorb::Channel (readonly)

Note:

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



46
47
48
# File 'lib/discorb/gateway_events.rb', line 46

def channel
  @channel
end

#channel_idDiscorb::Snowflake (readonly)



35
36
37
# File 'lib/discorb/gateway_events.rb', line 35

def channel_id
  @channel_id
end

#dataHash (readonly)



30
31
32
# File 'lib/discorb/gateway_events.rb', line 30

def data
  @data
end

#emojiDiscorb::UnicodeEmoji, Discorb::PartialEmoji (readonly)



54
55
56
# File 'lib/discorb/gateway_events.rb', line 54

def emoji
  @emoji
end

#guildnil, Discorb::Guild (readonly)

Note:

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



49
50
51
# File 'lib/discorb/gateway_events.rb', line 49

def guild
  @guild
end

#guild_idDiscorb::Snowflake (readonly)



39
40
41
# File 'lib/discorb/gateway_events.rb', line 39

def guild_id
  @guild_id
end

#messagenil, Discorb::Message (readonly)

Note:

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



52
53
54
# File 'lib/discorb/gateway_events.rb', line 52

def message
  @message
end

#message_idDiscorb::Snowflake (readonly)



37
38
39
# File 'lib/discorb/gateway_events.rb', line 37

def message_id
  @message_id
end

#usernil, ... (readonly) Also known as: member

Note:

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



42
43
44
# File 'lib/discorb/gateway_events.rb', line 42

def user
  @user
end

#user_idDiscorb::Snowflake (readonly) Also known as: member_id



32
33
34
# File 'lib/discorb/gateway_events.rb', line 32

def user_id
  @user_id
end

Instance Method Details

#fetch_message(force: false) ⇒ Async::Task<Discorb::Message>

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



112
113
114
115
116
117
118
# File 'lib/discorb/gateway_events.rb', line 112

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

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