Class: Discorb::GatewayHandler::ReactionEvent
- Inherits:
 - 
      GatewayEvent
      
        
- Object
 - GatewayEvent
 - Discorb::GatewayHandler::ReactionEvent
 
 
- Defined in:
 - lib/discorb/gateway.rb
 
Overview
Represents a reaction event.
Instance Attribute Summary collapse
- #channel -> nil, Discorb::Channel readonly
 - 
  
    
      #channel_id -> Discorb::Snowflake 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The ID of the channel the message was sent in.
 - 
  
    
      #data -> Hash 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The raw data of the event.
 - 
  
    
      #emoji -> Discorb::UnicodeEmoji, Discorb::PartialEmoji 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The emoji that was reacted with.
 - #guild -> nil, Discorb::Guild readonly
 - 
  
    
      #guild_id -> Discorb::Snowflake 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The ID of the guild the message was sent in.
 - #member -> nil, Discorb::Member readonly
 - #message -> nil, Discorb::Message readonly
 - 
  
    
      #message_id -> Discorb::Snowflake 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The ID of the message.
 - #user -> nil, Discorb::User readonly
 - 
  
    
      #user_id -> Discorb::Snowflake 
    
    
      (also: #member_id)
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The ID of the user who reacted.
 
Instance Method Summary collapse
- 
  
    
      #fetch_message(force: false) -> Discorb::Message 
    
    
  
  
  
  
  
  
  
  
  
    
Fetch the message.
 
Instance Attribute Details
#channel -> nil, Discorb::Channel (readonly)
This method returns an object from client cache. it will return nil if the object is not in cache.
      41 42 43  | 
    
      # File 'lib/discorb/gateway.rb', line 41 def channel @channel end  | 
  
#channel_id -> Discorb::Snowflake (readonly)
Returns The ID of the channel the message was sent in.
      31 32 33  | 
    
      # File 'lib/discorb/gateway.rb', line 31 def channel_id @channel_id end  | 
  
#data -> Hash (readonly)
Returns The raw data of the event.
      26 27 28  | 
    
      # File 'lib/discorb/gateway.rb', line 26 def data @data end  | 
  
#emoji -> Discorb::UnicodeEmoji, Discorb::PartialEmoji (readonly)
Returns The emoji that was reacted with.
      52 53 54  | 
    
      # File 'lib/discorb/gateway.rb', line 52 def emoji @emoji end  | 
  
#guild -> nil, Discorb::Guild (readonly)
This method returns an object from client cache. it will return nil if the object is not in cache.
      44 45 46  | 
    
      # File 'lib/discorb/gateway.rb', line 44 def guild @guild end  | 
  
#guild_id -> Discorb::Snowflake (readonly)
Returns The ID of the guild the message was sent in.
      35 36 37  | 
    
      # File 'lib/discorb/gateway.rb', line 35 def guild_id @guild_id end  | 
  
#member -> nil, Discorb::Member (readonly)
This method returns an object from client cache. it will return nil if the object is not in cache.
      50 51 52  | 
    
      # File 'lib/discorb/gateway.rb', line 50 def member @member end  | 
  
#message -> nil, Discorb::Message (readonly)
This method returns an object from client cache. it will return nil if the object is not in cache.
      47 48 49  | 
    
      # File 'lib/discorb/gateway.rb', line 47 def @message end  | 
  
#message_id -> Discorb::Snowflake (readonly)
Returns The ID of the message.
      33 34 35  | 
    
      # File 'lib/discorb/gateway.rb', line 33 def @message_id end  | 
  
#user -> nil, Discorb::User (readonly)
This method returns an object from client cache. it will return nil if the object is not in cache.
      38 39 40  | 
    
      # File 'lib/discorb/gateway.rb', line 38 def user @user end  | 
  
#user_id -> Discorb::Snowflake (readonly) Also known as: member_id
Returns The ID of the user who reacted.
      28 29 30  | 
    
      # File 'lib/discorb/gateway.rb', line 28 def user_id @user_id end  | 
  
Instance Method Details
#fetch_message(force: false) -> Discorb::Message
This is an asynchronous method, it will return a Async::Task object. Use Async::Task#wait to get the result.
This method calls HTTP request.
Fetch the message. If message is cached, it will be returned.
      91 92 93 94 95 96 97  | 
    
      # File 'lib/discorb/gateway.rb', line 91 def (force: false) Async do |_task| next @message if !force && @message @message = @channel.(@message_id).wait end end  |