Class: Discorb::Reaction

Inherits:
DiscordModel show all
Defined in:
lib/discorb/reaction.rb

Overview

Represents a reaction to a message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DiscordModel

#==, #eql?, #hash

Instance Attribute Details

#count -> Integer (readonly)

Returns The number of users that have reacted with this emoji.

Returns:

  • (Integer)

    The number of users that have reacted with this emoji.



9
10
11
# File 'lib/discorb/reaction.rb', line 9

def count
  @count
end

#emoji -> Discorb::Emoji (readonly)

Returns The emoji that was reacted with.

Returns:



11
12
13
# File 'lib/discorb/reaction.rb', line 11

def emoji
  @emoji
end

#me -> Boolean (readonly) Also known as: me?, reacted?

Returns Whether client user reacted with this emoji.

Returns:

  • (Boolean)

    Whether client user reacted with this emoji.



15
16
17
# File 'lib/discorb/reaction.rb', line 15

def me
  @me
end

#message -> Discorb::Message (readonly)

Returns The message that this reaction is on.

Returns:



13
14
15
# File 'lib/discorb/reaction.rb', line 13

def message
  @message
end

Instance Method Details

#fetch_users -> Array<Discorb::User>

Fetch the user that reacted with this emoji.

Parameters:

  • emoji (Discorb::Emoji)

    The emoji to fetch.

  • limit (Integer, nil)

    The maximum number of users to fetch. nil for no limit.

  • after (Discorb::Snowflake, nil)

    The ID of the user to start fetching from.

Returns:

  • (Array<Discorb::User>)

    The users that reacted with this emoji.



32
33
34
# File 'lib/discorb/reaction.rb', line 32

def fetch_users(...)
  message.fetch_reacted_users(@emoji, ...)
end