Class: Discordrb::Reaction
- Inherits:
-
Object
- Object
- Discordrb::Reaction
- Defined in:
- lib/discordrb/data.rb
Overview
A reaction to a message
Instance Attribute Summary collapse
-
#count ⇒ Integer
readonly
The amount of users who have reacted with this reaction.
-
#id ⇒ Integer
readonly
The ID of the emoji, if it was custom.
-
#me ⇒ true, false
(also: #me?)
readonly
Whether the current bot or user used this reaction.
-
#name ⇒ String
readonly
The name or unicode representation of the emoji.
Instance Method Summary collapse
-
#initialize(data) ⇒ Reaction
constructor
A new instance of Reaction.
Constructor Details
#initialize(data) ⇒ Reaction
Returns a new instance of Reaction.
1981 1982 1983 1984 1985 1986 |
# File 'lib/discordrb/data.rb', line 1981 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 |
Instance Attribute Details
#count ⇒ Integer (readonly)
Returns the amount of users who have reacted with this reaction.
1969 1970 1971 |
# File 'lib/discordrb/data.rb', line 1969 def count @count end |
#id ⇒ Integer (readonly)
Returns the ID of the emoji, if it was custom.
1976 1977 1978 |
# File 'lib/discordrb/data.rb', line 1976 def id @id end |
#me ⇒ true, false (readonly) Also known as: me?
Returns whether the current bot or user used this reaction.
1972 1973 1974 |
# File 'lib/discordrb/data.rb', line 1972 def me @me end |
#name ⇒ String (readonly)
Returns the name or unicode representation of the emoji.
1979 1980 1981 |
# File 'lib/discordrb/data.rb', line 1979 def name @name end |