Class: Discordrb::Activity
- Inherits:
-
Object
- Object
- Discordrb::Activity
- Defined in:
- lib/discordrb/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
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.
27 28 29 |
# File 'lib/discordrb/data/activity.rb', line 27 def application_id @application_id end |
#assets ⇒ Assets? (readonly)
Returns images for the presence and their texts.
49 50 51 |
# File 'lib/discordrb/data/activity.rb', line 49 def assets @assets end |
#created_at ⇒ Time (readonly)
Returns the time when the activity was added to the user's session.
58 59 60 |
# File 'lib/discordrb/data/activity.rb', line 58 def created_at @created_at end |
#details ⇒ String? (readonly)
Returns details about what the player is currently doing.
30 31 32 |
# File 'lib/discordrb/data/activity.rb', line 30 def details @details end |
#emoji ⇒ Emoji? (readonly)
Returns emoji data for custom statuses.
55 56 57 |
# File 'lib/discordrb/data/activity.rb', line 55 def emoji @emoji end |
#flags ⇒ Integer (readonly)
Returns a bitmask of activity flags.
40 41 42 |
# File 'lib/discordrb/data/activity.rb', line 40 def flags @flags end |
#instance ⇒ true, false (readonly)
Returns whether or not the activity is an instanced game session.
36 37 38 |
# File 'lib/discordrb/data/activity.rb', line 36 def instance @instance end |
#name ⇒ String (readonly)
Returns the activity's name.
18 19 20 |
# File 'lib/discordrb/data/activity.rb', line 18 def name @name end |
#party ⇒ Party? (readonly)
Returns information about the player's current party.
52 53 54 |
# File 'lib/discordrb/data/activity.rb', line 52 def party @party end |
#secrets ⇒ Secrets? (readonly)
Returns secrets for rich presence, joining, and spectating.
46 47 48 |
# File 'lib/discordrb/data/activity.rb', line 46 def secrets @secrets end |
#state ⇒ String? (readonly)
Returns the user's current party status.
33 34 35 |
# File 'lib/discordrb/data/activity.rb', line 33 def state @state end |
#timestamps ⇒ Timestamps? (readonly)
Returns times for the start and/or end of the activity.
43 44 45 |
# File 'lib/discordrb/data/activity.rb', line 43 def @timestamps end |
#type ⇒ Integer? (readonly)
21 22 23 |
# File 'lib/discordrb/data/activity.rb', line 21 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/discordrb/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/discordrb/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/discordrb/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/discordrb/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/discordrb/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/discordrb/data/activity.rb', line 106 def sync? flag_set? :sync end |