Class: Discorb::Presence::Activity
- Inherits:
-
DiscordModel
- Object
- DiscordModel
- Discorb::Presence::Activity
- Defined in:
- lib/discorb/presence.rb
Overview
Represents an activity of a user.
Defined Under Namespace
Classes: Asset, Button, Flag, Party, Secrets, Timestamps
Instance Attribute Summary collapse
-
#application_id -> Discorb::Snowflake
readonly
The application id of the activity.
- #assets -> Discorb::Presence::Activity::Asset? readonly
- #buttons -> Array<Discorb::Presence::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 -> Discorb::Emoji
readonly
The emoji of the activity.
-
#flags -> Discorb::Presence::Activity::Flag
readonly
The flags of the activity.
- #instance -> Discorb::StageInstance? readonly
-
#name -> String
readonly
The name of the activity.
- #party -> Discorb::Presence::Activity::Party? readonly
-
#state -> String
readonly
The state of party.
-
#timestamps -> Discorb::Presence::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 -> Discorb::Snowflake (readonly)
Returns The application id of the activity.
67 68 69 |
# File 'lib/discorb/presence.rb', line 67 def application_id @application_id end |
#assets -> Discorb::Presence::Activity::Asset? (readonly)
79 80 81 |
# File 'lib/discorb/presence.rb', line 79 def assets @assets end |
#buttons -> Array<Discorb::Presence::Activity::Button>? (readonly)
85 86 87 |
# File 'lib/discorb/presence.rb', line 85 def @buttons end |
#created_at -> Time (readonly) Also known as: started_at
Returns The time the activity was created.
62 63 64 |
# File 'lib/discorb/presence.rb', line 62 def created_at @created_at end |
#details -> String (readonly)
Returns The details of the activity.
69 70 71 |
# File 'lib/discorb/presence.rb', line 69 def details @details end |
#emoji -> Discorb::Emoji (readonly)
Returns The emoji of the activity.
73 74 75 |
# File 'lib/discorb/presence.rb', line 73 def emoji @emoji end |
#flags -> Discorb::Presence::Activity::Flag (readonly)
Returns The flags of the activity.
87 88 89 |
# File 'lib/discorb/presence.rb', line 87 def flags @flags end |
#instance -> Discorb::StageInstance? (readonly)
82 83 84 |
# File 'lib/discorb/presence.rb', line 82 def instance @instance end |
#name -> String (readonly)
Returns The name of the activity.
56 57 58 |
# File 'lib/discorb/presence.rb', line 56 def name @name end |
#party -> Discorb::Presence::Activity::Party? (readonly)
76 77 78 |
# File 'lib/discorb/presence.rb', line 76 def party @party end |
#state -> String (readonly)
Returns The state of party.
71 72 73 |
# File 'lib/discorb/presence.rb', line 71 def state @state end |
#timestamps -> Discorb::Presence::Activity::Timestamps (readonly)
Returns The timestamps of the activity.
65 66 67 |
# File 'lib/discorb/presence.rb', line 65 def @timestamps end |
#type -> :game, ... (readonly)
Returns The type of the activity.
58 59 60 |
# File 'lib/discorb/presence.rb', line 58 def type @type end |
#url -> String (readonly)
Returns The url of the activity.
60 61 62 |
# File 'lib/discorb/presence.rb', line 60 def url @url end |
Instance Method Details
#to_s -> String
Convert the activity to a string.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/discorb/presence.rb', line 130 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}" end end |