try adding "author" to embed
This commit is contained in:
parent
d233ae17ff
commit
d6a03db2aa
1 changed files with 25 additions and 6 deletions
|
@ -16,6 +16,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -122,12 +123,30 @@ func sendWebhook(client webhook.Client, deal api.Deal) {
|
||||||
if deal.Image == "" {
|
if deal.Image == "" {
|
||||||
message.SetContent(fmt.Sprintf("%v %v\n", content, deal.Url))
|
message.SetContent(fmt.Sprintf("%v %v\n", content, deal.Url))
|
||||||
} else {
|
} else {
|
||||||
message.SetContent(content).SetEmbeds(
|
embed := discord.NewEmbedBuilder().
|
||||||
discord.NewEmbedBuilder().
|
|
||||||
SetTitle(deal.Title).
|
SetTitle(deal.Title).
|
||||||
SetURL(deal.Url).
|
SetURL(deal.Url).
|
||||||
SetImage(deal.Image).
|
SetImage(deal.Image)
|
||||||
Build())
|
var author, icon string
|
||||||
|
switch {
|
||||||
|
case strings.HasPrefix(deal.Id, "epic-"):
|
||||||
|
author = "Epic Games"
|
||||||
|
icon = "https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Epic_Games_logo.svg/207px-Epic_Games_logo.svg.png"
|
||||||
|
case strings.HasPrefix(deal.Id, "gog-"):
|
||||||
|
author = "GOG.com"
|
||||||
|
icon = "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2e/GOG.com_logo.svg/391px-GOG.com_logo.svg.png"
|
||||||
|
case strings.HasPrefix(deal.Id, "humblebundle-"):
|
||||||
|
author = "Humble Bundle"
|
||||||
|
icon = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Humble_Bundle_logo.svg/320px-Humble_Bundle_logo.svg.png"
|
||||||
|
case strings.HasPrefix(deal.Id, "steam-"):
|
||||||
|
author = "Steam"
|
||||||
|
icon = "https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Steam_icon_logo.svg/240px-Steam_icon_logo.svg.png"
|
||||||
|
case strings.HasPrefix(deal.Id, "ubisoft-"):
|
||||||
|
author = "Ubisoft"
|
||||||
|
icon = "https://upload.wikimedia.org/wikipedia/commons/thumb/7/78/Ubisoft_logo.svg/262px-Ubisoft_logo.svg.png"
|
||||||
|
}
|
||||||
|
embed.SetAuthor(author, "", icon)
|
||||||
|
message.SetContent(content).SetEmbeds(embed.Build())
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := client.CreateMessage(message.Build(),
|
if _, err := client.CreateMessage(message.Build(),
|
||||||
|
|
Loading…
Reference in a new issue