class Discordrb::Embed

An Embed object that is contained in a message A freshly generated embed object will not appear in a message object unless grabbed from its ID in a channel.

Attributes

author[R]

@return [EmbedAuthor, nil] the author of the embed object. `nil` if there is not an author

color[R]

@return [String, nil] the color of the embed object. `nil` if there is not a color

colour[R]

@return [String, nil] the color of the embed object. `nil` if there is not a color

description[R]

@return [String, nil] the description of the embed object. `nil` if there is not a description

fields[R]

@return [Array<EmbedField>, nil] the fields of the embed object. `nil` if there are no fields

image[R]

@return [EmbedImage, nil] the image of the embed object. `nil` if there is not an image

message[R]

@return [Message] the message this embed object is contained in.

provider[R]

@return [EmbedProvider, nil] the provider of the embed object. `nil` if there is not a provider

thumbnail[R]

@return [EmbedThumbnail, nil] the thumbnail of the embed object. `nil` if there is not a thumbnail

timestamp[R]

@return [Time, nil] the timestamp of the embed object. `nil` if there is not a timestamp

title[R]

@return [String, nil] the title of the embed object. `nil` if there is not a title

type[R]

@return [Symbol] the type of the embed object. Possible types are:

* `:link`
* `:video`
* `:image`
url[R]

@return [String] the URL this embed object is based on.

video[R]

@return [EmbedVideo, nil] the video of the embed object. `nil` if there is not a video

Public Class Methods

new(data, message) click to toggle source

@!visibility private

# File lib/discordrb/data.rb, line 2150
def initialize(data, message)
  @message = message

  @url = data['url']
  @title = data['title']
  @type = data['type'].to_sym
  @description = data['description']
  @timestamp = data['timestamp'].nil? ? nil : Time.parse(data['timestamp'])
  @color = data['color']
  @footer = data['footer'].nil? ? nil : EmbedFooter.new(data['footer'], self)
  @image = data['image'].nil? ? nil : EmbedImage.new(data['image'], self)
  @video = data['video'].nil? ? nil : EmbedVideo.new(data['video'], self)
  @provider = data['provider'].nil? ? nil : EmbedProvider.new(data['provider'], self)
  @thumbnail = data['thumbnail'].nil? ? nil : EmbedThumbnail.new(data['thumbnail'], self)
  @author = data['author'].nil? ? nil : EmbedAuthor.new(data['author'], self)
  @fields = data['fields'].nil? ? nil : data['fields'].map { |field| EmbedField.new(field, self) }
end