mirror of
https://github.com/mii443/rbot.git
synced 2025-08-22 15:45:30 +00:00
Changed to return embed
This commit is contained in:
@ -11,7 +11,20 @@ module Bot
|
||||
body = {"longUrl" => url}.to_json
|
||||
res = post_json(SHORTEN_URL + CONFIG[:google][:apikey], body)
|
||||
json = JSON.parse(res.body)
|
||||
event.respond json["id"]
|
||||
|
||||
event.channel.send_embed do |embed|
|
||||
embed.color = CONFIG[:google][:color]
|
||||
embed.author = Discordrb::Webhooks::EmbedAuthor.new(
|
||||
name: 'URL Shortener',
|
||||
icon_url: 'https://lh3.googleusercontent.com/kroer1kpwSe3j-lIfPnE7Q3MVaCoJVF8atjdh0VtGDWCz2ulLejVsDh2k6a6VUgpUFQ8qRMHMEX7bsr2jTrLXhZR_ETbqILDf-qfkk0=h128'
|
||||
)
|
||||
embed.footer = Discordrb::Webhooks::EmbedFooter.new(
|
||||
text: "Created by #{event.author.name}",
|
||||
icon_url: "#{event.author.avatar_url}"
|
||||
)
|
||||
embed.add_field(name: 'Original', value: "#{url}")
|
||||
embed.add_field(name: 'Shortened', value: "#{json["id"]}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user