Class: Discordrb::Events::PlayingEvent
- Inherits:
-
Object
- Object
- 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 ⇒ Object
readonly
Returns the value of attribute game.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
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.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/discordrb/events/presence.rb', line 47 def initialize(data, bot) @user = bot.user(data['user']['id'].to_i) if data['game'] @game = data['game']['name'] else @game = nil end @server = bot.server(data['guild_id'].to_i) end |
Instance Attribute Details
#game ⇒ Object (readonly)
Returns the value of attribute game.
45 46 47 |
# File 'lib/discordrb/events/presence.rb', line 45 def game @game end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
45 46 47 |
# File 'lib/discordrb/events/presence.rb', line 45 def server @server end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
45 46 47 |
# File 'lib/discordrb/events/presence.rb', line 45 def user @user end |