Class: Rubot::BetterEmbed
- Inherits:
-
Discordrb::Webhooks::Embed
- Object
- Discordrb::Webhooks::Embed
- Rubot::BetterEmbed
- Defined in:
- lib/rubot/utils/better_embed.rb
Instance Method Summary collapse
-
#author(author) ⇒ Discordrb::Webhooks::Embed
set the embed's author.
-
#color(color) ⇒ Discordrb::Webhooks::Embed
set the embed's color.
-
#description(description) ⇒ Discordrb::Webhooks::Embed
set the embed's description.
-
#footer(footer) ⇒ Discordrb::Webhooks::Embed
set the embed's footer.
-
#image(image) ⇒ Discordrb::Webhooks::Embed
set the embed's image.
-
#initialize(template = nil) ⇒ BetterEmbed
constructor
A new instance of BetterEmbed.
-
#templates(template) ⇒ Discordrb::Embed
Returns prebuilt Discordrb::Embed.
-
#thumbnail(thumbnail) ⇒ Discordrb::Webhooks::Embed
set the embed's thumbnail.
-
#timestamp(timestamp) ⇒ Discordrb::Webhooks::Embed
set the embed's timestamp.
-
#title(title) ⇒ Discordrb::Webhooks::Embed
set the embed's title.
-
#url(url) ⇒ Discordrb::Webhooks::Embed
set the embed's url.
Constructor Details
#initialize(template = nil) ⇒ BetterEmbed
6 7 8 9 |
# File 'lib/rubot/utils/better_embed.rb', line 6 def initialize(template = nil) super() templates(template.to_sym) if template end |
Instance Method Details
#author(author) ⇒ Discordrb::Webhooks::Embed
set the embed's author
33 34 35 36 |
# File 'lib/rubot/utils/better_embed.rb', line 33 def () self. = self end |
#color(color) ⇒ Discordrb::Webhooks::Embed
set the embed's color
65 66 67 68 |
# File 'lib/rubot/utils/better_embed.rb', line 65 def color(color) self.color = color self end |
#description(description) ⇒ Discordrb::Webhooks::Embed
set the embed's description
41 42 43 44 |
# File 'lib/rubot/utils/better_embed.rb', line 41 def description(description) self.description = description self end |
#footer(footer) ⇒ Discordrb::Webhooks::Embed
set the embed's footer
73 74 75 76 |
# File 'lib/rubot/utils/better_embed.rb', line 73 def () self. = self end |
#image(image) ⇒ Discordrb::Webhooks::Embed
set the embed's image
97 98 99 100 |
# File 'lib/rubot/utils/better_embed.rb', line 97 def image(image) self.image = image self end |
#templates(template) ⇒ Discordrb::Embed
Returns prebuilt Discordrb::Embed.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rubot/utils/better_embed.rb', line 13 def templates(template) Hash[ :default => proc do (Time.at(Time.now.to_i)) color("ffbc95") end, :error => proc do (Time.at(Time.now.to_i)) color("ffbc95") end, :success => proc do (Time.at(Time.now.to_i)) color("ffbc95") end ][template.to_sym].call end |
#thumbnail(thumbnail) ⇒ Discordrb::Webhooks::Embed
set the embed's thumbnail
89 90 91 92 |
# File 'lib/rubot/utils/better_embed.rb', line 89 def thumbnail(thumbnail) self.thumbnail = thumbnail self end |
#timestamp(timestamp) ⇒ Discordrb::Webhooks::Embed
set the embed's timestamp
81 82 83 84 |
# File 'lib/rubot/utils/better_embed.rb', line 81 def () self. = self end |
#title(title) ⇒ Discordrb::Webhooks::Embed
set the embed's title
49 50 51 52 |
# File 'lib/rubot/utils/better_embed.rb', line 49 def title(title) self.title = title self end |
#url(url) ⇒ Discordrb::Webhooks::Embed
set the embed's url
57 58 59 60 |
# File 'lib/rubot/utils/better_embed.rb', line 57 def url(url) self.url = url self end |