Class: Discordrb::Activity::Assets

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

Overview

Assets for rich presence images and hover text

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#application_idString? (readonly)

Returns the application ID for these assets.

Returns:

  • (String, nil)

    the application ID for these assets.



176
177
178
# File 'lib/discordrb/data/activity.rb', line 176

def application_id
  @application_id
end

#large_image_idString? (readonly)

Returns the asset ID for the large image of this activity.

Returns:

  • (String, nil)

    the asset ID for the large image of this activity



164
165
166
# File 'lib/discordrb/data/activity.rb', line 164

def large_image_id
  @large_image_id
end

#large_textString? (readonly)

Returns text displayed when hovering over the large iamge.

Returns:

  • (String, nil)

    text displayed when hovering over the large iamge



167
168
169
# File 'lib/discordrb/data/activity.rb', line 167

def large_text
  @large_text
end

#small_image_idString? (readonly)

Returns the asset ID for the small image of this activity.

Returns:

  • (String, nil)

    the asset ID for the small image of this activity



170
171
172
# File 'lib/discordrb/data/activity.rb', line 170

def small_image_id
  @small_image_id
end

#small_textString? (readonly)

Returns:



173
174
175
# File 'lib/discordrb/data/activity.rb', line 173

def small_text
  @small_text
end

Instance Method Details

#large_image_url(format = 'webp') ⇒ String

Utility function to get an Asset's large image URL.

Parameters:

  • format (String, nil) (defaults to: 'webp')

    If nil, the URL will default to webp. You can otherwise specify one of webp, jpg, or png.

Returns:

  • (String)

    the URL to the large image asset.



190
191
192
# File 'lib/discordrb/data/activity.rb', line 190

def large_image_url(format = 'webp')
  API.asset_url(@application_id, @large_image_id, format)
end

#small_image_url(format = 'webp') ⇒ String

Utility function to get an Asset's large image URL.

Parameters:

  • format (String, nil) (defaults to: 'webp')

    If nil, the URL will default to webp. You can otherwise specify one of webp, jpg, or png.

Returns:

  • (String)

    the URL to the small image asset.



197
198
199
# File 'lib/discordrb/data/activity.rb', line 197

def small_image_url(format = 'webp')
  API.asset_url(@application_id, @small_image_id, format)
end