Class: Discordrb::Webhooks::EmbedFooter

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/webhooks/embeds.rb

Overview

An embed's footer will be displayed at the very bottom of an embed, together with the timestamp. An icon URL can be set together with some text to be displayed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text: nil, icon_url: nil) ⇒ EmbedFooter

Creates a new footer object.

Parameters:

  • text (String, nil) (defaults to: nil)

    The text to be displayed in the footer.

  • icon_url (String, nil) (defaults to: nil)

    The URL to an icon to be showed alongside the text.


128
129
130
131
# File 'lib/discordrb/webhooks/embeds.rb', line 128

def initialize(text: nil, icon_url: nil)
  @text = text
  @icon_url = icon_url
end

Instance Attribute Details

#icon_urlString?

Returns URL to an icon to be showed alongside the text.

Returns:

  • (String, nil)

    URL to an icon to be showed alongside the text


123
124
125
# File 'lib/discordrb/webhooks/embeds.rb', line 123

def icon_url
  @icon_url
end

#textString?

Returns text to be displayed in the footer.

Returns:

  • (String, nil)

    text to be displayed in the footer


120
121
122
# File 'lib/discordrb/webhooks/embeds.rb', line 120

def text
  @text
end

Instance Method Details

#to_hashHash

Returns a hash representation of this embed footer, to be converted to JSON.

Returns:

  • (Hash)

    a hash representation of this embed footer, to be converted to JSON.


134
135
136
137
138
139
# File 'lib/discordrb/webhooks/embeds.rb', line 134

def to_hash
  {
    text: @text,
    icon_url: @icon_url
  }
end