class Discordrb::Reaction
A reaction to a message.
Attributes
count[R]
@return [Integer] the amount of users who have reacted with this reaction
id[R]
@return [Integer] the ID of the emoji, if it was custom
me[R]
@return [true, false] whether the current bot or user used this reaction
me?[R]
@return [true, false] whether the current bot or user used this reaction
name[R]
@return [String] the name or unicode representation of the emoji
Public Class Methods
new(data)
click to toggle source
# File lib/discordrb/data.rb, line 2688 def initialize(data) @count = data['count'] @me = data['me'] @id = data['emoji']['id'].nil? ? nil : data['emoji']['id'].to_i @name = data['emoji']['name'] end
Public Instance Methods
to_s()
click to toggle source
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`. @return [String] the name of this reaction, including the ID if it is a custom emoji
# File lib/discordrb/data.rb, line 2698 def to_s id.nil? ? name : "#{name}:#{id}" end