class Discorb::Message::Reference
Represents reference of message.
Attributes
@return [Discorb::Snowflake] The channel ID.
@return [Boolean] Whether fail the request if the message is not found.
@return [Boolean] Whether fail the request if the message is not found.
@return [Discorb::Snowflake] The guild ID.
@return [Discorb::Snowflake] The message ID.
Public Class Methods
Initialize a new reference from a hash.
@param [Hash] data The hash.
@return [Discorb::Message::Reference] The reference. @see discord.com/developers/docs/resources/channel#message-reference-object
# File lib/discorb/message.rb, line 493 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
Initialize a new reference.
@param [Discorb::Snowflake] guild_id
The guild ID. @param [Discorb::Snowflake] channel_id
The channel ID. @param [Discorb::Snowflake] message_id
The message ID. @param [Boolean] fail_if_not_exists
Whether fail the request if the message is not found.
# File lib/discorb/message.rb, line 462 def initialize(guild_id, channel_id, message_id, fail_if_not_exists: true) @guild_id = guild_id @channel_id = channel_id @message_id = message_id @fail_if_not_exists = fail_if_not_exists end
Public Instance Methods
Convert the reference to a hash.
@return [Hash] The hash.
# File lib/discorb/message.rb, line 474 def to_hash { message_id: @message_id, channel_id: @channel_id, guild_id: @guild_id, fail_if_not_exists: @fail_if_not_exists, } end