Class: Discorb::Message::Reference
- Inherits:
- 
      Object
      
        - Object
- Discorb::Message::Reference
 
- Defined in:
- lib/discorb/message.rb
Overview
Represents reference of message.
Instance Attribute Summary collapse
- 
  
    
      #channel_id -> Discorb::Snowflake 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    The channel ID. 
- 
  
    
      #fail_if_not_exists -> Boolean 
    
    
      (also: #fail_if_not_exists?)
    
  
  
  
  
    
    
  
  
  
  
  
  
    Whether fail the request if the message is not found. 
- 
  
    
      #guild_id -> Discorb::Snowflake 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    The guild ID. 
- 
  
    
      #message_id -> Discorb::Snowflake 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    The message ID. 
Class Method Summary collapse
- 
  
    
      .from_hash(data) -> Discorb::Message::Reference 
    
    
  
  
  
  
  
  
  
  
  
    Initialize a new reference from a hash. 
Instance Method Summary collapse
- 
  
    
      #initialize(guild_id, channel_id, message_id, fail_if_not_exists: true) -> Reference 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    Initialize a new reference. 
- 
  
    
      #to_hash -> Hash 
    
    
      (also: #to_reference)
    
  
  
  
  
  
  
  
  
  
    Convert the reference to a hash. 
Constructor Details
#initialize(guild_id, channel_id, message_id, fail_if_not_exists: true) -> Reference
Initialize a new reference.
| 554 555 556 557 558 559 | # File 'lib/discorb/message.rb', line 554 def initialize(guild_id, channel_id, , fail_if_not_exists: true) @guild_id = guild_id @channel_id = channel_id @message_id = @fail_if_not_exists = fail_if_not_exists end | 
Instance Attribute Details
#channel_id -> Discorb::Snowflake
Returns The channel ID.
| 538 539 540 | # File 'lib/discorb/message.rb', line 538 def channel_id @channel_id end | 
#fail_if_not_exists -> Boolean Also known as: fail_if_not_exists?
Returns Whether fail the request if the message is not found.
| 542 543 544 | # File 'lib/discorb/message.rb', line 542 def fail_if_not_exists @fail_if_not_exists end | 
#guild_id -> Discorb::Snowflake
Returns The guild ID.
| 536 537 538 | # File 'lib/discorb/message.rb', line 536 def guild_id @guild_id end | 
#message_id -> Discorb::Snowflake
Returns The message ID.
| 540 541 542 | # File 'lib/discorb/message.rb', line 540 def @message_id end | 
Class Method Details
.from_hash(data) -> Discorb::Message::Reference
Initialize a new reference from a hash.
| 585 586 587 | # File 'lib/discorb/message.rb', line 585 def self.from_hash(data) new(data[:guild_id], data[:channel_id], data[:message_id], fail_if_not_exists: data[:fail_if_not_exists]) end | 
Instance Method Details
#to_hash -> Hash Also known as: to_reference
Convert the reference to a hash.
| 566 567 568 569 570 571 572 573 | # File 'lib/discorb/message.rb', line 566 def to_hash { message_id: @message_id, channel_id: @channel_id, guild_id: @guild_id, fail_if_not_exists: @fail_if_not_exists, } end |