class Discordrb::Events::PlayingEvent

Event raised when a user starts or stops playing a game

Attributes

activity[R]

@return [Discordrb::Activity] The new activity

client_status[R]

@return [Hash<Symbol, Symbol>] the current online status (‘:online`, `:idle` or `:dnd`) of the user

on various device types (`:desktop`, `:mobile`, or `:web`). The value will be `nil` if the user is offline or invisible.
server[R]

@return [Server] the server on which the presence update happened.

user[R]

@return [User] the user whose status got updated.

Public Class Methods

new(data, activity, bot) click to toggle source
# File lib/discordrb/events/presence.rb, line 85
def initialize(data, activity, bot)
  @bot = bot
  @activity = activity

  @server = bot.server(data['guild_id'].to_i)
  @user = bot.user(data['user']['id'].to_i)
  @client_status = @user.client_status
end

Public Instance Methods

game() click to toggle source

@return [String] the name of the new game the user is playing.

# File lib/discordrb/events/presence.rb, line 95
def game
  @activity.name
end