Class: Discordrb::Attachment
- Inherits:
-
Object
- Object
- Discordrb::Attachment
- Includes:
- IDObject
- Defined in:
- lib/discordrb/data.rb
Overview
An attachment to a message
Instance Attribute Summary collapse
-
#filename ⇒ String
readonly
The attachment's filename.
-
#height ⇒ Integer?
readonly
The height of an image file, in pixels, or nil if the file is not an image.
-
#message ⇒ Message
readonly
The message this attachment belongs to.
-
#proxy_url ⇒ String
readonly
The attachment's proxy URL - I'm not sure what exactly this does, but I think it has something to do with CDNs.
-
#size ⇒ Integer
readonly
The attachment's file size in bytes.
-
#url ⇒ String
readonly
The CDN URL this attachment can be downloaded at.
-
#width ⇒ Integer?
readonly
The width of an image file, in pixels, or nil if the file is not an image.
Attributes included from IDObject
Instance Method Summary collapse
-
#image? ⇒ true, false
Whether this file is an image file.
Methods included from IDObject
#==, #creation_time, synthesise
Instance Attribute Details
#filename ⇒ String (readonly)
Returns the attachment's filename.
1658 1659 1660 |
# File 'lib/discordrb/data.rb', line 1658 def filename @filename end |
#height ⇒ Integer? (readonly)
Returns the height of an image file, in pixels, or nil if the file is not an image.
1667 1668 1669 |
# File 'lib/discordrb/data.rb', line 1667 def height @height end |
#message ⇒ Message (readonly)
Returns the message this attachment belongs to.
1648 1649 1650 |
# File 'lib/discordrb/data.rb', line 1648 def @message end |
#proxy_url ⇒ String (readonly)
Returns the attachment's proxy URL - I'm not sure what exactly this does, but I think it has something to do with CDNs.
1655 1656 1657 |
# File 'lib/discordrb/data.rb', line 1655 def proxy_url @proxy_url end |
#size ⇒ Integer (readonly)
Returns the attachment's file size in bytes.
1661 1662 1663 |
# File 'lib/discordrb/data.rb', line 1661 def size @size end |
#url ⇒ String (readonly)
Returns the CDN URL this attachment can be downloaded at.
1651 1652 1653 |
# File 'lib/discordrb/data.rb', line 1651 def url @url end |
#width ⇒ Integer? (readonly)
Returns the width of an image file, in pixels, or nil if the file is not an image.
1664 1665 1666 |
# File 'lib/discordrb/data.rb', line 1664 def width @width end |
Instance Method Details
#image? ⇒ true, false
Returns whether this file is an image file.
1685 1686 1687 |
# File 'lib/discordrb/data.rb', line 1685 def image? !(@width.nil? || @height.nil?) end |