Class: Discordrb::Events::ReactionEvent
- Includes:
- Respondable
- Defined in:
- lib/discordrb/events/reactions.rb
Overview
Generic superclass for events about adding and removing reactions
Direct Known Subclasses
Instance Attribute Summary collapse
-
#burst ⇒ true, false
(also: #burst?)
readonly
Whether the reaction is a burst reaction.
-
#burst_colours ⇒ Array<ColourRGB>
(also: #burst_colors)
readonly
An array of colors used for animations in burst reactions.
-
#emoji ⇒ Emoji
readonly
The emoji that was reacted with.
-
#type ⇒ Integer
readonly
The type of the reaction.
Attributes inherited from Event
Instance Method Summary collapse
-
#channel ⇒ Channel
The channel that was reacted in.
-
#message ⇒ Message
The message that was reacted to.
-
#server ⇒ Server?
The server that was reacted in.
-
#user ⇒ User, Member
The user that reacted to this message, or member if a server exists.
Methods included from Respondable
#<<, #drain, #drain_into, #send_embed, #send_message, #send_message!, #send_temporary_message
Instance Attribute Details
#burst ⇒ true, false (readonly) Also known as: burst?
Returns whether the reaction is a burst reaction.
18 19 20 |
# File 'lib/discordrb/events/reactions.rb', line 18 def burst @burst end |
#burst_colours ⇒ Array<ColourRGB> (readonly) Also known as: burst_colors
Returns an array of colors used for animations in burst reactions.
25 26 27 |
# File 'lib/discordrb/events/reactions.rb', line 25 def burst_colours @burst_colours end |
#emoji ⇒ Emoji (readonly)
Returns the emoji that was reacted with.
12 13 14 |
# File 'lib/discordrb/events/reactions.rb', line 12 def emoji @emoji end |
#type ⇒ Integer (readonly)
Returns the type of the reaction. 0 for normal, 1 for burst.
22 23 24 |
# File 'lib/discordrb/events/reactions.rb', line 22 def type @type end |
Instance Method Details
#channel ⇒ Channel
Returns the channel that was reacted in.
57 58 59 |
# File 'lib/discordrb/events/reactions.rb', line 57 def channel @channel ||= @bot.channel(@channel_id) end |
#message ⇒ Message
Returns the message that was reacted to.
52 53 54 |
# File 'lib/discordrb/events/reactions.rb', line 52 def @message ||= channel.(@message_id) end |
#server ⇒ Server?
Returns the server that was reacted in. If reacted in a PM channel, it will be nil.
62 63 64 |
# File 'lib/discordrb/events/reactions.rb', line 62 def server @server ||= channel.server end |
#user ⇒ User, Member
Returns the user that reacted to this message, or member if a server exists.
42 43 44 45 46 47 48 49 |
# File 'lib/discordrb/events/reactions.rb', line 42 def user # Cache the user so we don't do requests all the time @user ||= if server @server.member(@user_id) else @bot.user(@user_id) end end |