Class: Discordrb::Components::MediaItem
- Inherits:
-
Object
- Object
- Discordrb::Components::MediaItem
- Defined in:
- lib/discordrb/data/component.rb
Overview
Resolved metadata about a piece of media.
Constant Summary collapse
- FLAGS =
Mapping of flags.
{ animated: 1 << 0 }.freeze
Instance Attribute Summary collapse
-
#attachment_id ⇒ Integer?
readonly
The ID of the uploaded attachment.
-
#content_type ⇒ String?
readonly
The content type of the media item.
-
#flags ⇒ Integer
readonly
The flags of the media item.
-
#height ⇒ Integer?
readonly
The height of the media item.
-
#placeholder ⇒ String?
readonly
The placeholder of the media item.
-
#placeholder_version ⇒ Integer?
readonly
The version of the thumbhash for images and videos, if any.
-
#proxy_url ⇒ String?
readonly
The proxied URL to the media item.
-
#url ⇒ String
readonly
The URL to the media item.
-
#width ⇒ Integer?
readonly
The width of the media item.
Instance Method Summary collapse
-
#animated? ⇒ true, false
Whether or not the media item is animated.
Instance Attribute Details
#attachment_id ⇒ Integer? (readonly)
Returns the ID of the uploaded attachment. Only present
when the media item was uploaded via an attachment://<filename> reference.
477 478 479 |
# File 'lib/discordrb/data/component.rb', line 477 def @attachment_id end |
#content_type ⇒ String? (readonly)
Returns the content type of the media item.
473 474 475 |
# File 'lib/discordrb/data/component.rb', line 473 def content_type @content_type end |
#flags ⇒ Integer (readonly)
Returns the flags of the media item.
458 459 460 |
# File 'lib/discordrb/data/component.rb', line 458 def flags @flags end |
#height ⇒ Integer? (readonly)
Returns the height of the media item.
464 465 466 |
# File 'lib/discordrb/data/component.rb', line 464 def height @height end |
#placeholder ⇒ String? (readonly)
Returns the placeholder of the media item.
470 471 472 |
# File 'lib/discordrb/data/component.rb', line 470 def placeholder @placeholder end |
#placeholder_version ⇒ Integer? (readonly)
Returns the version of the thumbhash for images and videos, if any.
480 481 482 |
# File 'lib/discordrb/data/component.rb', line 480 def placeholder_version @placeholder_version end |
#proxy_url ⇒ String? (readonly)
Returns the proxied URL to the media item.
467 468 469 |
# File 'lib/discordrb/data/component.rb', line 467 def proxy_url @proxy_url end |
#url ⇒ String (readonly)
Returns the URL to the media item.
455 456 457 |
# File 'lib/discordrb/data/component.rb', line 455 def url @url end |
#width ⇒ Integer? (readonly)
Returns the width of the media item.
461 462 463 |
# File 'lib/discordrb/data/component.rb', line 461 def width @width end |
Instance Method Details
#animated? ⇒ true, false
Returns whether or not the media item is animated.
498 499 500 501 502 |
# File 'lib/discordrb/data/component.rb', line 498 FLAGS.each do |name, value| define_method("#{name}?") do @flags.anybits?(value) end end |