class Discordrb::Events::ReactionEvent
Generic superclass for events about adding and removing reactions
Attributes
emoji[R]
@return [Emoji] the emoji that was reacted with.
Public Class Methods
new(data, bot)
click to toggle source
# File lib/discordrb/events/reactions.rb, line 14 def initialize(data, bot) @bot = bot @emoji = Discordrb::Emoji.new(data['emoji'], bot, nil) @user_id = data['user_id'].to_i @message_id = data['message_id'].to_i @channel_id = data['channel_id'].to_i end
Public Instance Methods
channel()
click to toggle source
@return [Channel] the channel that was reacted in.
# File lib/discordrb/events/reactions.rb, line 39 def channel @channel ||= @bot.channel(@channel_id) end
message()
click to toggle source
@return [Message] the message that was reacted to.
# File lib/discordrb/events/reactions.rb, line 34 def message @message ||= channel.load_message(@message_id) end
server()
click to toggle source
@return [Server, nil] the server that was reacted in. If reacted in a PM channel, it will be nil.
# File lib/discordrb/events/reactions.rb, line 44 def server @server ||= channel.server end
user()
click to toggle source
@return [User, Member] the user that reacted to this message, or member if a server exists.
# File lib/discordrb/events/reactions.rb, line 24 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