Class: Discordrb::Events::PlayingEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/events/presence.rb

Overview

Event raised when a user starts or stops playing a game

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, bot) ⇒ PlayingEvent

Returns a new instance of PlayingEvent.



47
48
49
50
51
52
53
# File 'lib/discordrb/events/presence.rb', line 47

def initialize(data, 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

#gameObject (readonly)

Returns the value of attribute game.



45
46
47
# File 'lib/discordrb/events/presence.rb', line 45

def game
  @game
end

#serverObject (readonly)

Returns the value of attribute server.



45
46
47
# File 'lib/discordrb/events/presence.rb', line 45

def server
  @server
end

#userObject (readonly)

Returns the value of attribute user.



45
46
47
# File 'lib/discordrb/events/presence.rb', line 45

def user
  @user
end