class Discordrb::Activity::Assets

Assets for rich presence images and hover text

Attributes

application_id[R]

@return [String, nil] the application ID for these assets.

large_image_id[R]

@return [String, nil] the asset ID for the large image of this activity

large_text[R]

@return [String, nil] text displayed when hovering over the large iamge

small_image_id[R]

@return [String, nil] the asset ID for the small image of this activity

small_text[R]

@return [String, nil]

Public Class Methods

new(data, application_id) click to toggle source

@!visibility private

# File lib/discordrb/data/activity.rb, line 179
def initialize(data, application_id)
  @application_id = application_id
  @large_image_id = data['large_image']
  @large_text = data['large_text']
  @small_image_id = data['small_image']
  @small_text = data['small_text']
end

Public Instance Methods

large_image_url(format = 'webp') click to toggle source

Utility function to get an Asset’s large image URL. @param format [String, nil] If ‘nil`, the URL will default to `webp`. You can otherwise specify one of `webp`, `jpg`, or `png`. @return [String] the URL to the large image asset.

# 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') click to toggle source

Utility function to get an Asset’s large image URL. @param format [String, nil] If ‘nil`, the URL will default to `webp`. You can otherwise specify one of `webp`, `jpg`, or `png`. @return [String] the URL to the small image asset.

# File lib/discordrb/data/activity.rb, line 197
def small_image_url(format = 'webp')
  API.asset_url(@application_id, @small_image_id, format)
end