Class: Discordrb::MessageActivity

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data/message_activity.rb

Overview

A rich-presence activity attached to a message.

Constant Summary collapse

TYPES =

Map of activity types.

{
  join: 1,
  spectate: 2,
  listen: 3,
  join_request: 5
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#party_idString? (readonly)

Returns the party ID of the activity.

Returns:

  • (String, nil)

    the party ID of the activity.



18
19
20
# File 'lib/discordrb/data/message_activity.rb', line 18

def party_id
  @party_id
end

#typeInteger (readonly)

Returns the type of the activity.

Returns:

  • (Integer)

    the type of the activity.



15
16
17
# File 'lib/discordrb/data/message_activity.rb', line 15

def type
  @type
end

Instance Method Details

#join?true, false

Returns whether or not the activity type is join.

Returns:

  • (true, false)

    whether or not the activity type is join.



35
36
37
38
39
# File 'lib/discordrb/data/message_activity.rb', line 35

TYPES.each do |name, value|
  define_method("#{name}?") do
    @type == value
  end
end

#join_request?true, false

Returns whether or not the activity type is a join request.

Returns:

  • (true, false)

    whether or not the activity type is a join request.



35
36
37
38
39
# File 'lib/discordrb/data/message_activity.rb', line 35

TYPES.each do |name, value|
  define_method("#{name}?") do
    @type == value
  end
end

#listen?true, false

Returns whether or not the activity type is listen.

Returns:

  • (true, false)

    whether or not the activity type is listen.



35
36
37
38
39
# File 'lib/discordrb/data/message_activity.rb', line 35

TYPES.each do |name, value|
  define_method("#{name}?") do
    @type == value
  end
end

#spectate?true, false

Returns whether or not the activity type is spectate.

Returns:

  • (true, false)

    whether or not the activity type is spectate.



35
36
37
38
39
# File 'lib/discordrb/data/message_activity.rb', line 35

TYPES.each do |name, value|
  define_method("#{name}?") do
    @type == value
  end
end