Class: MijDiscord::Events::UpdatePresence

Inherits:
Server show all
Defined in:
lib/mij-discord/events/server.rb

Instance Attribute Summary collapse

Attributes inherited from Server

#server

Attributes inherited from Generic

#bot

Instance Method Summary collapse

Methods inherited from EventBase

delegate_method, filter_match, inherited, #inspect, #trigger?

Constructor Details

#initialize(bot, data) ⇒ UpdatePresence

Returns a new instance of UpdatePresence.



77
78
79
80
81
82
83
84
85
86
# File 'lib/mij-discord/events/server.rb', line 77

def initialize(bot, data)
  super(bot, bot.server(data['guild_id']))

  @user = @bot.user(data['user']['id'])
  @status = data['status'].to_sym

  if (game = data['game'])
    @game = MijDiscord::Data::Game.new(game)
  end
end

Instance Attribute Details

#gameObject (readonly)

Returns the value of attribute game.



70
71
72
# File 'lib/mij-discord/events/server.rb', line 70

def game
  @game
end

#statusObject (readonly)

Returns the value of attribute status.



68
69
70
# File 'lib/mij-discord/events/server.rb', line 68

def status
  @status
end

#userObject (readonly)

Returns the value of attribute user.



66
67
68
# File 'lib/mij-discord/events/server.rb', line 66

def user
  @user
end

Instance Method Details

#memberObject



88
89
90
# File 'lib/mij-discord/events/server.rb', line 88

def member
  @server&.member(@user.id)
end