Class: Discordrb::Events::PresenceEvent
- Defined in:
- lib/discordrb/events/presence.rb
Overview
Event raised when a user's presence state updates (idle or online)
Instance Attribute Summary collapse
-
#server ⇒ Server
readonly
The server on which the presence update happened.
-
#status ⇒ Symbol
readonly
The new status.
-
#user ⇒ User
readonly
The user whose status got updated.
Attributes inherited from Event
Instance Method Summary collapse
-
#initialize(data, bot) ⇒ PresenceEvent
constructor
A new instance of PresenceEvent.
Constructor Details
#initialize(data, bot) ⇒ PresenceEvent
Returns a new instance of PresenceEvent.
18 19 20 21 22 23 24 |
# File 'lib/discordrb/events/presence.rb', line 18 def initialize(data, bot) @bot = bot @user = bot.user(data['user']['id'].to_i) @status = data['status'].to_sym @server = bot.server(data['guild_id'].to_i) end |
Instance Attribute Details
#server ⇒ Server (readonly)
Returns the server on which the presence update happened.
10 11 12 |
# File 'lib/discordrb/events/presence.rb', line 10 def server @server end |
#status ⇒ Symbol (readonly)
Returns the new status.
16 17 18 |
# File 'lib/discordrb/events/presence.rb', line 16 def status @status end |
#user ⇒ User (readonly)
Returns the user whose status got updated.
13 14 15 |
# File 'lib/discordrb/events/presence.rb', line 13 def user @user end |