Class: Rubycord::Activity

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#application_idString? (readonly)



25
26
27
# File 'lib/rubycord/data/activity.rb', line 25

def application_id
  @application_id
end

#assetsAssets? (readonly)



47
48
49
# File 'lib/rubycord/data/activity.rb', line 47

def assets
  @assets
end

#created_atTime (readonly)



56
57
58
# File 'lib/rubycord/data/activity.rb', line 56

def created_at
  @created_at
end

#detailsString? (readonly)



28
29
30
# File 'lib/rubycord/data/activity.rb', line 28

def details
  @details
end

#emojiEmoji? (readonly)



53
54
55
# File 'lib/rubycord/data/activity.rb', line 53

def emoji
  @emoji
end

#flagsInteger (readonly)

Returns a bitmask of activity flags.

See Also:



38
39
40
# File 'lib/rubycord/data/activity.rb', line 38

def flags
  @flags
end

#instancetrue, false (readonly)



34
35
36
# File 'lib/rubycord/data/activity.rb', line 34

def instance
  @instance
end

#nameString (readonly)



16
17
18
# File 'lib/rubycord/data/activity.rb', line 16

def name
  @name
end

#partyParty? (readonly)



50
51
52
# File 'lib/rubycord/data/activity.rb', line 50

def party
  @party
end

#secretsSecrets? (readonly)



44
45
46
# File 'lib/rubycord/data/activity.rb', line 44

def secrets
  @secrets
end

#stateString? (readonly)



31
32
33
# File 'lib/rubycord/data/activity.rb', line 31

def state
  @state
end

#timestampsTimestamps? (readonly)



41
42
43
# File 'lib/rubycord/data/activity.rb', line 41

def timestamps
  @timestamps
end

#typeInteger? (readonly)



19
20
21
# File 'lib/rubycord/data/activity.rb', line 19

def type
  @type
end

#urlString? (readonly)



22
23
24
# File 'lib/rubycord/data/activity.rb', line 22

def url
  @url
end

Instance Method Details

#instance?true, false



116
117
118
# File 'lib/rubycord/data/activity.rb', line 116

def instance?
  @instance || flag_set?(:instance)
end

#join?true, false



91
92
93
# File 'lib/rubycord/data/activity.rb', line 91

def join?
  flag_set? :join
end

#join_request?true, false



101
102
103
# File 'lib/rubycord/data/activity.rb', line 101

def join_request?
  flag_set? :join_request
end

#play?true, false



111
112
113
# File 'lib/rubycord/data/activity.rb', line 111

def play?
  flag_set? :play
end

#spectate?true, false



96
97
98
# File 'lib/rubycord/data/activity.rb', line 96

def spectate?
  flag_set? :spectate
end

#sync?true, false



106
107
108
# File 'lib/rubycord/data/activity.rb', line 106

def sync?
  flag_set? :sync
end