Class: Discordrb::Reaction

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data/reaction.rb

Overview

A reaction to a message.

Constant Summary collapse

TYPES =

Map of reaction types.

{
  normal: 0,
  burst: 1
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#burst_coloursArray<ColourRGB> (readonly) Also known as: burst_colors

Returns an array of colors used for animations in burst reactions.

Returns:

  • (Array<ColourRGB>)

    an array of colors used for animations in burst reactions



30
31
32
# File 'lib/discordrb/data/reaction.rb', line 30

def burst_colours
  @burst_colours
end

#burst_countInteger (readonly)

Returns the total amount of users who have reacted with this reaction as a burst reaction.

Returns:

  • (Integer)

    the total amount of users who have reacted with this reaction as a burst reaction



34
35
36
# File 'lib/discordrb/data/reaction.rb', line 34

def burst_count
  @burst_count
end

#countInteger (readonly)

Returns the total amount of users who have reacted with this reaction (including burst reactions).

Returns:

  • (Integer)

    the total amount of users who have reacted with this reaction (including burst reactions)



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

def count
  @count
end

#idInteger (readonly)

Returns the ID of the emoji, if it was custom.

Returns:

  • (Integer)

    the ID of the emoji, if it was custom



20
21
22
# File 'lib/discordrb/data/reaction.rb', line 20

def id
  @id
end

#metrue, false (readonly) Also known as: me?

Returns whether the current bot or user used this reaction.

Returns:

  • (true, false)

    whether the current bot or user used this reaction



16
17
18
# File 'lib/discordrb/data/reaction.rb', line 16

def me
  @me
end

#me_bursttrue, false (readonly) Also known as: me_burst?

Returns whether the current bot or user used this reaction as a burst reaction.

Returns:

  • (true, false)

    whether the current bot or user used this reaction as a burst reaction



26
27
28
# File 'lib/discordrb/data/reaction.rb', line 26

def me_burst
  @me_burst
end

#nameString (readonly)

Returns the name or unicode representation of the emoji.

Returns:

  • (String)

    the name or unicode representation of the emoji



23
24
25
# File 'lib/discordrb/data/reaction.rb', line 23

def name
  @name
end

#normal_countInteger (readonly)

Returns the total amount of users who have reacted with this reaction as a normal reaction.

Returns:

  • (Integer)

    the total amount of users who have reacted with this reaction as a normal reaction



37
38
39
# File 'lib/discordrb/data/reaction.rb', line 37

def normal_count
  @normal_count
end

Instance Method Details

#to_sString

Converts this Reaction into a string that can be sent back to Discord in other reaction endpoints. If ID is present, it will be rendered into the form of name:id.

Returns:

  • (String)

    the name of this reaction, including the ID if it is a custom emoji



54
55
56
# File 'lib/discordrb/data/reaction.rb', line 54

def to_s
  id.nil? ? name : "#{name}:#{id}"
end