Class: MijDiscord::Events::Reaction
- Defined in:
- lib/mij-discord/events/message.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#emoji ⇒ Object
readonly
Returns the value of attribute emoji.
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes inherited from Generic
Instance Method Summary collapse
-
#initialize(bot, data) ⇒ Reaction
constructor
A new instance of Reaction.
- #message ⇒ Object
Methods inherited from EventBase
delegate_method, filter_match, inherited, #inspect, #trigger?
Constructor Details
#initialize(bot, data) ⇒ Reaction
Returns a new instance of Reaction.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/mij-discord/events/message.rb', line 123 def initialize(bot, data) super(bot) @message_id = data['message_id'].to_i @channel = @bot.channel(data['channel_id']) user_id, server = data['user_id'], @channel.server @user = server ? server.member(user_id) : @bot.user(user_id) if user_id if (emoji = data['emoji']) @emoji = server&.emoji(emoji['id']) @emoji ||= MijDiscord::Data::Emoji.new(emoji, nil) end end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
112 113 114 |
# File 'lib/mij-discord/events/message.rb', line 112 def channel @channel end |
#emoji ⇒ Object (readonly)
Returns the value of attribute emoji.
108 109 110 |
# File 'lib/mij-discord/events/message.rb', line 108 def emoji @emoji end |
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
114 115 116 |
# File 'lib/mij-discord/events/message.rb', line 114 def @message_id end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
110 111 112 |
# File 'lib/mij-discord/events/message.rb', line 110 def user @user end |
Instance Method Details
#message ⇒ Object
138 139 140 |
# File 'lib/mij-discord/events/message.rb', line 138 def @channel.(@message_id) end |