class Discorb::Gateway::MessageUpdateEvent
Represents a `MESSAGE_UPDATE` event.
Attributes
@return [Discorb::Message] The message after update.
@return [Array<Discorb::Attachment>] The attachments in the message.
@return [Discorb::Message] The message before update.
@return [Discorb::Snowflake] The ID of the channel the message was sent in.
@return [String] The new content of the message.
@return [Array<Discorb::Embed>] The embeds in the message.
@return [Discorb::Snowflake] The ID of the guild the message was sent in.
@return [Discorb::Snowflake] The ID of the message.
@return [Boolean] Whether the message pings @everyone.
@macro client_cache @return [Array<Discorb::Role>] The roles mentioned in the message.
@return [Time] The time the message was edited.
Public Class Methods
@!attribute [r] channel
@macro client_cache @return [Discorb::Channel] The channel the message was sent in.
@!attribute [r] guild
@macro client_cache @return [Discorb::Guild] The guild the message was sent in.
# File lib/discorb/gateway.rb, line 240 def initialize(client, data, before, after) @client = client @data = data @before = before @after = after @id = Snowflake.new(data[:id]) @channel_id = Snowflake.new(data[:channel_id]) @guild_id = Snowflake.new(data[:guild_id]) if data.key?(:guild_id) @content = data[:content] @timestamp = Time.iso8601(data[:edited_timestamp]) @mention_everyone = data[:mention_everyone] @mention_roles = data[:mention_roles].map { |r| guild.roles[r] } if data.key?(:mention_roles) @attachments = data[:attachments].map { |a| Attachment.new(a) } if data.key?(:attachments) @embeds = data[:embeds] ? data[:embeds].map { |e| Embed.new(data: e) } : [] if data.key?(:embeds) end
Public Instance Methods
# File lib/discorb/gateway.rb, line 256 def channel @client.channels[@channel_id] end
Fetch the message. @macro async @macro http
@return [Discorb::Message] The message.
# File lib/discorb/gateway.rb, line 269 def fetch_message Async do channel.fetch_message(@id).wait end end
# File lib/discorb/gateway.rb, line 260 def guild @client.guilds[@guild_id] end