diff --git a/cmd/dealsbot/main.go b/cmd/dealsbot/main.go index 70d1828..ec25ba2 100644 --- a/cmd/dealsbot/main.go +++ b/cmd/dealsbot/main.go @@ -16,6 +16,7 @@ import ( "os" "os/signal" "reflect" + "strings" "syscall" "time" ) @@ -122,12 +123,30 @@ func sendWebhook(client webhook.Client, deal api.Deal) { if deal.Image == "" { message.SetContent(fmt.Sprintf("%v %v\n", content, deal.Url)) } else { - message.SetContent(content).SetEmbeds( - discord.NewEmbedBuilder(). - SetTitle(deal.Title). - SetURL(deal.Url). - SetImage(deal.Image). - Build()) + embed := discord.NewEmbedBuilder(). + SetTitle(deal.Title). + SetURL(deal.Url). + SetImage(deal.Image) + 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(),