Class: RubyCord::User::Activity
- Inherits:
-
DiscordModel
- Object
- DiscordModel
- RubyCord::User::Activity
- Defined in:
- lib/rubycord/user/activity.rb
Overview
Represents an activity of a user.
Defined Under Namespace
Classes: Asset, Button, Flag, Party, Secrets, Timestamps
Instance Attribute Summary collapse
-
#application_id ⇒ RubyCord::Snowflake
readonly
The application id of the activity.
- #assets ⇒ RubyCord::User::Activity::Asset? readonly
- #buttons ⇒ Array<RubyCord::User::Activity::Button>? readonly
-
#created_at ⇒ Time
(also: #started_at)
readonly
The time the activity was created.
-
#details ⇒ String
readonly
The details of the activity.
-
#emoji ⇒ RubyCord::Emoji
readonly
The emoji of the activity.
-
#flags ⇒ RubyCord::User::Activity::Flag
readonly
The flags of the activity.
- #instance ⇒ RubyCord::Guild::StageChannel::StageInstance? readonly
-
#name ⇒ String
readonly
The name of the activity.
- #party ⇒ RubyCord::User::Activity::Party? readonly
-
#state ⇒ String
readonly
The state of party.
-
#timestamps ⇒ RubyCord::User::Activity::Timestamps
readonly
The timestamps of the activity.
-
#type ⇒ :game, ...
readonly
The type of the activity.
-
#url ⇒ String
readonly
The url of the activity.
Instance Method Summary collapse
-
#to_s ⇒ String
Convert the activity to a string.
Methods inherited from DiscordModel
Instance Attribute Details
#application_id ⇒ RubyCord::Snowflake (readonly)
Returns The application id of the activity.
18 19 20 |
# File 'lib/rubycord/user/activity.rb', line 18 def application_id @application_id end |
#assets ⇒ RubyCord::User::Activity::Asset? (readonly)
30 31 32 |
# File 'lib/rubycord/user/activity.rb', line 30 def assets @assets end |
#buttons ⇒ Array<RubyCord::User::Activity::Button>? (readonly)
36 37 38 |
# File 'lib/rubycord/user/activity.rb', line 36 def @buttons end |
#created_at ⇒ Time (readonly) Also known as: started_at
Returns The time the activity was created.
13 14 15 |
# File 'lib/rubycord/user/activity.rb', line 13 def created_at @created_at end |
#details ⇒ String (readonly)
Returns The details of the activity.
20 21 22 |
# File 'lib/rubycord/user/activity.rb', line 20 def details @details end |
#emoji ⇒ RubyCord::Emoji (readonly)
Returns The emoji of the activity.
24 25 26 |
# File 'lib/rubycord/user/activity.rb', line 24 def emoji @emoji end |
#flags ⇒ RubyCord::User::Activity::Flag (readonly)
Returns The flags of the activity.
38 39 40 |
# File 'lib/rubycord/user/activity.rb', line 38 def flags @flags end |
#instance ⇒ RubyCord::Guild::StageChannel::StageInstance? (readonly)
33 34 35 |
# File 'lib/rubycord/user/activity.rb', line 33 def instance @instance end |
#name ⇒ String (readonly)
Returns The name of the activity.
7 8 9 |
# File 'lib/rubycord/user/activity.rb', line 7 def name @name end |
#party ⇒ RubyCord::User::Activity::Party? (readonly)
27 28 29 |
# File 'lib/rubycord/user/activity.rb', line 27 def party @party end |
#state ⇒ String (readonly)
Returns The state of party.
22 23 24 |
# File 'lib/rubycord/user/activity.rb', line 22 def state @state end |
#timestamps ⇒ RubyCord::User::Activity::Timestamps (readonly)
Returns The timestamps of the activity.
16 17 18 |
# File 'lib/rubycord/user/activity.rb', line 16 def @timestamps end |
#type ⇒ :game, ... (readonly)
Returns The type of the activity.
9 10 11 |
# File 'lib/rubycord/user/activity.rb', line 9 def type @type end |
#url ⇒ String (readonly)
Returns The url of the activity.
11 12 13 |
# File 'lib/rubycord/user/activity.rb', line 11 def url @url end |
Instance Method Details
#to_s ⇒ String
Convert the activity to a string.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/rubycord/user/activity.rb', line 87 def to_s case @type when :game "Playing #{@name}" when :streaming "Streaming #{@details}" when :listening "Listening to #{@name}" when :watching "Watching #{@name}" when :custom "#{@emoji} #{@state}" when :competing "Competing in #{@name}" else raise "Unknown activity type: #{@type}" end end |