Class: MijDiscord::Events::UpdatePresence
- Defined in:
- lib/mij-discord/events/server.rb
Instance Attribute Summary collapse
-
#game ⇒ Object
readonly
Returns the value of attribute game.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes inherited from Server
Attributes inherited from Generic
Instance Method Summary collapse
-
#initialize(bot, data) ⇒ UpdatePresence
constructor
A new instance of UpdatePresence.
- #member ⇒ Object
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
#game ⇒ Object (readonly)
Returns the value of attribute game.
70 71 72 |
# File 'lib/mij-discord/events/server.rb', line 70 def game @game end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
68 69 70 |
# File 'lib/mij-discord/events/server.rb', line 68 def status @status end |
#user ⇒ Object (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
#member ⇒ Object
88 89 90 |
# File 'lib/mij-discord/events/server.rb', line 88 def member @server&.member(@user.id) end |