Class: Discordrb::Embed

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data/embed.rb

Overview

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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#authorEmbedAuthor? (readonly)

Returns the author of the embed object. nil if there is not an author.

Returns:

  • (EmbedAuthor, nil)

    the author of the embed object. nil if there is not an author



47
48
49
# File 'lib/discordrb/data/embed.rb', line 47

def author
  @author
end

#colorString? (readonly) Also known as: colour

Returns the color of the embed object. nil if there is not a color.

Returns:

  • (String, nil)

    the color of the embed object. nil if there is not a color



28
29
30
# File 'lib/discordrb/data/embed.rb', line 28

def color
  @color
end

#descriptionString? (readonly)

Returns the description of the embed object. nil if there is not a description.

Returns:

  • (String, nil)

    the description of the embed object. nil if there is not a description



15
16
17
# File 'lib/discordrb/data/embed.rb', line 15

def description
  @description
end

#fieldsArray<EmbedField>? (readonly)

Returns the fields of the embed object. nil if there are no fields.

Returns:

  • (Array<EmbedField>, nil)

    the fields of the embed object. nil if there are no fields



50
51
52
# File 'lib/discordrb/data/embed.rb', line 50

def fields
  @fields
end

Returns the footer of the embed object. nil if there is not a footer.

Returns:

  • (EmbedFooter, nil)

    the footer of the embed object. nil if there is not a footer



32
33
34
# File 'lib/discordrb/data/embed.rb', line 32

def footer
  @footer
end

#imageEmbedImage? (readonly)

Returns the image of the embed object. nil if there is not an image.

Returns:

  • (EmbedImage, nil)

    the image of the embed object. nil if there is not an image



38
39
40
# File 'lib/discordrb/data/embed.rb', line 38

def image
  @image
end

#providerEmbedProvider? (readonly)

Returns the provider of the embed object. nil if there is not a provider.

Returns:

  • (EmbedProvider, nil)

    the provider of the embed object. nil if there is not a provider



35
36
37
# File 'lib/discordrb/data/embed.rb', line 35

def provider
  @provider
end

#thumbnailEmbedThumbnail? (readonly)

Returns the thumbnail of the embed object. nil if there is not a thumbnail.

Returns:

  • (EmbedThumbnail, nil)

    the thumbnail of the embed object. nil if there is not a thumbnail



41
42
43
# File 'lib/discordrb/data/embed.rb', line 41

def thumbnail
  @thumbnail
end

#timestampTime? (readonly)

Returns the timestamp of the embed object. nil if there is not a timestamp.

Returns:

  • (Time, nil)

    the timestamp of the embed object. nil if there is not a timestamp



25
26
27
# File 'lib/discordrb/data/embed.rb', line 25

def timestamp
  @timestamp
end

#titleString? (readonly)

Returns the title of the embed object. nil if there is not a title.

Returns:

  • (String, nil)

    the title of the embed object. nil if there is not a title



12
13
14
# File 'lib/discordrb/data/embed.rb', line 12

def title
  @title
end

#typeSymbol (readonly)

Returns the type of the embed object. Possible types are:

  • :link
  • :video
  • :image.

Returns:

  • (Symbol)

    the type of the embed object. Possible types are:

    • :link
    • :video
    • :image


22
23
24
# File 'lib/discordrb/data/embed.rb', line 22

def type
  @type
end

#urlString (readonly)

Returns the URL this embed object is based on.

Returns:

  • (String)

    the URL this embed object is based on.



9
10
11
# File 'lib/discordrb/data/embed.rb', line 9

def url
  @url
end

#videoEmbedVideo? (readonly)

Returns the video of the embed object. nil if there is not a video.

Returns:

  • (EmbedVideo, nil)

    the video of the embed object. nil if there is not a video



44
45
46
# File 'lib/discordrb/data/embed.rb', line 44

def video
  @video
end

Instance Method Details

#messageMessage?

Returns the message this embed object is contained in.

Returns:

  • (Message, nil)

    the message this embed object is contained in.



72
73
74
# File 'lib/discordrb/data/embed.rb', line 72

def message
  @message unless @message.is_a?(Snapshot)
end

#snapshotSnapshot?

Returns the message snapshot this embed object is contained in.

Returns:

  • (Snapshot, nil)

    the message snapshot this embed object is contained in.



77
78
79
# File 'lib/discordrb/data/embed.rb', line 77

def snapshot
  @message unless @message.is_a?(Message)
end