class Discordrb::Events::PlayingEvent
Event
raised when a user starts or stops playing a game
Attributes
details[R]
@return [String] what the player is currently doing (ex. game being streamed)
game[R]
@return [String] the new game the user is playing.
server[R]
@return [Server] the server on which the presence update happened.
type[R]
@return [Integer] the type of play. 0 = game, 1 = Twitch
url[R]
@return [String] the URL to the stream
user[R]
@return [User] the user whose status got updated.
Public Class Methods
new(data, bot)
click to toggle source
# File lib/discordrb/events/presence.rb, line 74 def initialize(data, bot) @bot = bot @server = bot.server(data['guild_id'].to_i) @user = bot.user(data['user']['id'].to_i) @game = data['game'] ? data['game']['name'] : nil @type = data['game'] ? data['game']['type'].to_i : nil # Handle optional 'game' fields safely @url = data['game'] && data['game']['url'] ? data['game']['url'] : nil @details = data['game'] && data['game']['details'] ? data['game']['details'] : nil end