fix webhook url

This commit is contained in:
Sotirios Pupakis
2025-09-25 01:28:33 +02:00
parent 20e1b99248
commit bf3ea1bf62

View File

@@ -40,12 +40,13 @@ func CreateAddon(c *gin.Context) {
} }
lastWebhookTime = time.Now() lastWebhookTime = time.Now()
oldNbr := nbrOfUnsentWebhooks
nbrOfUnsentWebhooks = 0 nbrOfUnsentWebhooks = 0
go func() { go func() {
webhookURL := initializers.ScraperWebhook webhookURL := initializers.ScraperWebhook
if webhookURL != "" { if webhookURL != "" {
text := fmt.Sprintf("New %d addons found\nLast: %s (%s).", nbrOfUnsentWebhooks, addon.ID, addon.Name) text := fmt.Sprintf("New %d addons found\nLast: %s (%s).", oldNbr, addon.ID, addon.Name)
colour := 2228479 colour := 2228479
size := fmt.Sprintf("%.2f MB", float64(addon.CurrentVersionSize)/1_000_000) size := fmt.Sprintf("%.2f MB", float64(addon.CurrentVersionSize)/1_000_000)
@@ -75,7 +76,7 @@ func CreateAddon(c *gin.Context) {
Embeds: []models.CustomEmbed{myEmbed}, Embeds: []models.CustomEmbed{myEmbed},
} }
err := SendCustomWebhook(initializers.DiscordWebhook, myHook) err := SendCustomWebhook(webhookURL, myHook)
if err != nil { if err != nil {
fmt.Println("Error sending webhook:", err) fmt.Println("Error sending webhook:", err)
} }
@@ -133,7 +134,7 @@ func CreateAddon(c *gin.Context) {
Embeds: []models.CustomEmbed{myEmbed}, Embeds: []models.CustomEmbed{myEmbed},
} }
err := SendCustomWebhook(initializers.DiscordWebhook, myHook) err := SendCustomWebhook(webhookURL, myHook)
if err != nil { if err != nil {
fmt.Println("Error sending webhook:", err) fmt.Println("Error sending webhook:", err)
} }