Class: Rubycord::Activity
- Inherits:
-
Object
- Object
- Rubycord::Activity
- Defined in:
- lib/rubycord/data/activity.rb
Overview
Contains information about user activities such as the game they are playing, music they are listening to, or their live stream.
Defined Under Namespace
Classes: Assets, Party, Secrets, Timestamps
Constant Summary collapse
- FLAGS =
Values corresponding to the flags bitmask
-
{ instance: 1 << 0, # this activity is an instanced game session join: 1 << 1, # this activity is joinable spectate: 1 << 2, # this activity can be spectated join_request: 1 << 3, # this activity allows asking to join sync: 1 << 4, # this activity is a spotify track play: 1 << 5 # this game can be played or opened from discord }.freeze
- GAME =
Type indicating the activity is for a game
-
0
- STREAMING =
Type indicating the activity is a stream
-
1
- LISTENING =
Type indicating the activity is for music
-
2
- WATCHING =
This type is currently unused in the client but can be reported by bots
-
3
- CUSTOM =
Type indicating the activity is a custom status
-
4
- COMPETING =
Type indicating the activity is for a competitive game
-
5
Instance Attribute Summary collapse
-
#application_id ⇒ String?
readonly
The application ID for the game.
-
#assets ⇒ Assets?
readonly
Images for the presence and their texts.
-
#created_at ⇒ Time
readonly
The time when the activity was added to the user's session.
-
#details ⇒ String?
readonly
Details about what the player is currently doing.
-
#emoji ⇒ Emoji?
readonly
Emoji data for custom statuses.
-
#flags ⇒ Integer
readonly
A bitmask of activity flags.
-
#instance ⇒ true, false
readonly
Whether or not the activity is an instanced game session.
-
#name ⇒ String
readonly
The activity's name.
-
#party ⇒ Party?
readonly
Information about the player's current party.
-
#secrets ⇒ Secrets?
readonly
Secrets for rich presence, joining, and spectating.
-
#state ⇒ String?
readonly
The user's current party status.
-
#timestamps ⇒ Timestamps?
readonly
Times for the start and/or end of the activity.
-
#type ⇒ Integer?
readonly
Activity type.
-
#url ⇒ String?
readonly
Stream URL, when the activity type is STREAMING.
Instance Method Summary collapse
-
#instance? ⇒ true, false
Whether or not the
instance
flag is set for this activity. -
#join? ⇒ true, false
Whether or not the
join
flag is set for this activity. -
#join_request? ⇒ true, false
Whether or not the
join_request
flag is set for this activity. -
#play? ⇒ true, false
Whether or not the
play
flag is set for this activity. -
#spectate? ⇒ true, false
Whether or not the
spectate
flag is set for this activity. -
#sync? ⇒ true, false
Whether or not the
sync
flag is set for this activity.
Instance Attribute Details
#application_id ⇒ String? (readonly)
Returns the application ID for the game.
25 26 27 |
# File 'lib/rubycord/data/activity.rb', line 25 def application_id @application_id end |
#assets ⇒ Assets? (readonly)
Returns images for the presence and their texts.
47 48 49 |
# File 'lib/rubycord/data/activity.rb', line 47 def assets @assets end |
#created_at ⇒ Time (readonly)
Returns the time when the activity was added to the user's session.
56 57 58 |
# File 'lib/rubycord/data/activity.rb', line 56 def created_at @created_at end |
#details ⇒ String? (readonly)
Returns details about what the player is currently doing.
28 29 30 |
# File 'lib/rubycord/data/activity.rb', line 28 def details @details end |
#emoji ⇒ Emoji? (readonly)
Returns emoji data for custom statuses.
53 54 55 |
# File 'lib/rubycord/data/activity.rb', line 53 def emoji @emoji end |
#flags ⇒ Integer (readonly)
Returns a bitmask of activity flags.
38 39 40 |
# File 'lib/rubycord/data/activity.rb', line 38 def flags @flags end |
#instance ⇒ true, false (readonly)
Returns whether or not the activity is an instanced game session.
34 35 36 |
# File 'lib/rubycord/data/activity.rb', line 34 def instance @instance end |
#name ⇒ String (readonly)
Returns the activity's name.
16 17 18 |
# File 'lib/rubycord/data/activity.rb', line 16 def name @name end |
#party ⇒ Party? (readonly)
Returns information about the player's current party.
50 51 52 |
# File 'lib/rubycord/data/activity.rb', line 50 def party @party end |
#secrets ⇒ Secrets? (readonly)
Returns secrets for rich presence, joining, and spectating.
44 45 46 |
# File 'lib/rubycord/data/activity.rb', line 44 def secrets @secrets end |
#state ⇒ String? (readonly)
Returns the user's current party status.
31 32 33 |
# File 'lib/rubycord/data/activity.rb', line 31 def state @state end |
#timestamps ⇒ Timestamps? (readonly)
Returns times for the start and/or end of the activity.
41 42 43 |
# File 'lib/rubycord/data/activity.rb', line 41 def @timestamps end |
#type ⇒ Integer? (readonly)
19 20 21 |
# File 'lib/rubycord/data/activity.rb', line 19 def type @type end |
Instance Method Details
#instance? ⇒ true, false
Returns Whether or not the instance
flag is set for this activity.
116 117 118 |
# File 'lib/rubycord/data/activity.rb', line 116 def instance? @instance || flag_set?(:instance) end |
#join? ⇒ true, false
Returns Whether or not the join
flag is set for this activity.
91 92 93 |
# File 'lib/rubycord/data/activity.rb', line 91 def join? flag_set? :join end |
#join_request? ⇒ true, false
Returns Whether or not the join_request
flag is set for this activity.
101 102 103 |
# File 'lib/rubycord/data/activity.rb', line 101 def join_request? flag_set? :join_request end |
#play? ⇒ true, false
Returns Whether or not the play
flag is set for this activity.
111 112 113 |
# File 'lib/rubycord/data/activity.rb', line 111 def play? flag_set? :play end |
#spectate? ⇒ true, false
Returns Whether or not the spectate
flag is set for this activity.
96 97 98 |
# File 'lib/rubycord/data/activity.rb', line 96 def spectate? flag_set? :spectate end |
#sync? ⇒ true, false
Returns Whether or not the sync
flag is set for this activity.
106 107 108 |
# File 'lib/rubycord/data/activity.rb', line 106 def sync? flag_set? :sync end |