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.
      61 62 63  | 
    
      # File 'lib/discorb/presence.rb', line 61 def application_id @application_id end  | 
  
#assets -> Discorb::Presence::Activity::Asset? (readonly)
      73 74 75  | 
    
      # File 'lib/discorb/presence.rb', line 73 def assets @assets end  | 
  
#buttons -> Array<Discorb::Presence::Activity::Button>? (readonly)
      79 80 81  | 
    
      # File 'lib/discorb/presence.rb', line 79 def @buttons end  | 
  
#created_at -> Time (readonly) Also known as: started_at
Returns The time the activity was created.
      56 57 58  | 
    
      # File 'lib/discorb/presence.rb', line 56 def created_at @created_at end  | 
  
#details -> String (readonly)
Returns The details of the activity.
      63 64 65  | 
    
      # File 'lib/discorb/presence.rb', line 63 def details @details end  | 
  
#emoji -> Discorb::Emoji (readonly)
Returns The emoji of the activity.
      67 68 69  | 
    
      # File 'lib/discorb/presence.rb', line 67 def emoji @emoji end  | 
  
#flags -> Discorb::Presence::Activity::Flag (readonly)
Returns The flags of the activity.
      81 82 83  | 
    
      # File 'lib/discorb/presence.rb', line 81 def flags @flags end  | 
  
#instance -> Discorb::StageInstance? (readonly)
      76 77 78  | 
    
      # File 'lib/discorb/presence.rb', line 76 def instance @instance end  | 
  
#name -> String (readonly)
Returns The name of the activity.
      50 51 52  | 
    
      # File 'lib/discorb/presence.rb', line 50 def name @name end  | 
  
#party -> Discorb::Presence::Activity::Party? (readonly)
      70 71 72  | 
    
      # File 'lib/discorb/presence.rb', line 70 def party @party end  | 
  
#state -> String (readonly)
Returns The state of party.
      65 66 67  | 
    
      # File 'lib/discorb/presence.rb', line 65 def state @state end  | 
  
#timestamps -> Discorb::Presence::Activity::Timestamps (readonly)
Returns The timestamps of the activity.
      59 60 61  | 
    
      # File 'lib/discorb/presence.rb', line 59 def @timestamps end  | 
  
#type -> :game, ... (readonly)
Returns The type of the activity.
      52 53 54  | 
    
      # File 'lib/discorb/presence.rb', line 52 def type @type end  | 
  
#url -> String (readonly)
Returns The url of the activity.
      54 55 56  | 
    
      # File 'lib/discorb/presence.rb', line 54 def url @url end  | 
  
Instance Method Details
#to_s -> String
Convert the activity to a string.
      117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132  | 
    
      # File 'lib/discorb/presence.rb', line 117 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  |