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.


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

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


162
163
164
# File 'lib/discordrb/data/activity.rb', line 162

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


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

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


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

def small_image_id
  @small_image_id
end

#small_textString? (readonly)

Returns:


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

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.


188
189
190
# File 'lib/discordrb/data/activity.rb', line 188

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.


195
196
197
# File 'lib/discordrb/data/activity.rb', line 195

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