Class: Discorb::Gateway::ReactionRemoveAllEvent

Inherits:
GatewayEvent
  • Object
show all
Defined in:
lib/discorb/gateway.rb

Overview

Represents a MESSAGE_REACTION_REMOVE_ALL event.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#channel -> nil, Discorb::Channel (readonly)

Note:

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

Returns:

  • (nil)

    The object wasn't cached.

  • (Discorb::Channel)

    The channel the message was sent in.



110
111
112
# File 'lib/discorb/gateway.rb', line 110

def channel
  @channel
end

#channel_id -> Discorb::Snowflake (readonly)

Returns The ID of the channel the message was sent in.

Returns:



103
104
105
# File 'lib/discorb/gateway.rb', line 103

def channel_id
  @channel_id
end

#guild -> nil, Discorb::Guild (readonly)

Note:

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

Returns:

  • (nil)

    The object wasn't cached.

  • (Discorb::Guild)

    The guild the message was sent in.



113
114
115
# File 'lib/discorb/gateway.rb', line 113

def guild
  @guild
end

#guild_id -> Discorb::Snowflake (readonly)

Returns The ID of the guild the message was sent in.

Returns:



107
108
109
# File 'lib/discorb/gateway.rb', line 107

def guild_id
  @guild_id
end

#message -> nil, Discorb::Message (readonly)

Note:

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

Returns:

  • (nil)

    The object wasn't cached.

  • (Discorb::Message)

    The message the reaction was sent in.



116
117
118
# File 'lib/discorb/gateway.rb', line 116

def message
  @message
end

#message_id -> Discorb::Snowflake (readonly)

Returns The ID of the message.

Returns:



105
106
107
# File 'lib/discorb/gateway.rb', line 105

def message_id
  @message_id
end

Instance Method Details

#fetch_message(force: false) -> Discorb::Message

Note:

This is an asynchronous method, it will return a Async::Task object. Use Async::Task#wait to get the result.

Note:

This method calls HTTP request.

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

Parameters:

  • force (Boolean) (defaults to: false)

    Whether to force fetching the message.

Returns:

Raises:



138
139
140
141
142
143
144
# File 'lib/discorb/gateway.rb', line 138

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

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