Class: Discorb::DefaultAvatar

Inherits:
DiscordModel show all
Defined in:
lib/discorb/asset.rb

Overview

Represents a default avatar.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DiscordModel

#==, #eql?

Instance Attribute Details

#animated?false (readonly)

Returns For compatibility with Asset, always false.

Returns:

  • (false)

    For compatibility with Asset, always false.



# File 'lib/discorb/asset.rb', line 68

Instance Method Details

#inspectObject



97
98
99
# File 'lib/discorb/asset.rb', line 97

def inspect
  "#<#{self.class} #{@discriminator}>"
end

#url(image_format: nil, size: 1024) ⇒ String

Returns the URL of the avatar.

rubocop: disable Lint/UnusedMethodArgument

Parameters:

  • image_format (String) (defaults to: nil)

    The image format. This is compatible with Asset#url, will be ignored.

  • size (Integer) (defaults to: 1024)

    The size of the image. This is compatible with Asset#url, will be ignored.

Returns:

  • (String)

    URL of the avatar.



92
93
94
95
# File 'lib/discorb/asset.rb', line 92

def url(image_format: nil, size: 1024)
  # rubocop: enable Lint/UnusedMethodArgument
  "https://cdn.discordapp.com/embed/avatars/#{@discriminator.to_i % 5}.png"
end