Class: Discordrb::Events::PlayingEvent
- Defined in:
- lib/discordrb/events/presence.rb
Overview
Event raised when a user starts or stops playing a game
Instance Attribute Summary collapse
-
#game ⇒ String
readonly
The new game the user is playing.
-
#server ⇒ Server
readonly
The server on which the presence update happened.
-
#user ⇒ User
readonly
The user whose status got updated.
Attributes inherited from Event
Instance Method Summary collapse
-
#initialize(data, bot) ⇒ PlayingEvent
constructor
A new instance of PlayingEvent.
Constructor Details
#initialize(data, bot) ⇒ PlayingEvent
Returns a new instance of PlayingEvent.
65 66 67 68 69 70 71 |
# File 'lib/discordrb/events/presence.rb', line 65 def initialize(data, bot) @bot = bot @user = bot.user(data['user']['id'].to_i) @game = data['game'] ? data['game']['name'] : nil @server = bot.server(data['guild_id'].to_i) end |
Instance Attribute Details
#game ⇒ String (readonly)
Returns the new game the user is playing.
63 64 65 |
# File 'lib/discordrb/events/presence.rb', line 63 def game @game end |
#server ⇒ Server (readonly)
Returns the server on which the presence update happened.
57 58 59 |
# File 'lib/discordrb/events/presence.rb', line 57 def server @server end |
#user ⇒ User (readonly)
Returns the user whose status got updated.
60 61 62 |
# File 'lib/discordrb/events/presence.rb', line 60 def user @user end |