From cbd2695a81af3415a4a04664833729a24c0da0b3 Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Mon, 19 Jan 2026 23:16:28 +0100 Subject: [PATCH] fake discord feature --- lib/config.go | 3 ++- lib/runner.go | 5 +++-- lib/sender.discord.go | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/config.go b/lib/config.go index 2dbb9d8..52ea8df 100644 --- a/lib/config.go +++ b/lib/config.go @@ -10,6 +10,7 @@ type Config struct { GiteaToken string GiteaBaseURL string GiteaRepos []string - Webhook string + DiscordWebhook string + DiscordFake bool Interval time.Duration } diff --git a/lib/runner.go b/lib/runner.go index ea0a80e..8028df9 100644 --- a/lib/runner.go +++ b/lib/runner.go @@ -24,7 +24,8 @@ func getConfig() Config { GiteaToken: os.Getenv("GITEA_TOKEN"), GiteaBaseURL: os.Getenv("GITEA_BASE_URL"), GiteaRepos: strings.Split(os.Getenv("GITEA_REPOS"), ","), - Webhook: os.Getenv("DISCORD_WEBHOOK"), + DiscordWebhook: os.Getenv("DISCORD_WEBHOOK"), + DiscordFake: os.Getenv("DISCORD_FAKE") == "true", Interval: time.Duration(intervalMinutes) * time.Minute, } } @@ -79,6 +80,6 @@ func Runner() { cache.Save() - time.Sleep(config.Interval) + time.Sleep(100) } } diff --git a/lib/sender.discord.go b/lib/sender.discord.go index c742684..d46d8e9 100644 --- a/lib/sender.discord.go +++ b/lib/sender.discord.go @@ -12,5 +12,8 @@ type DiscordSender struct { func (d DiscordSender) Send(msg string) { b, _ := json.Marshal(map[string]string{"content": msg}) - http.Post(d.Config.Webhook, "application/json", bytes.NewBuffer(b)) + if d.Config.DiscordFake { + return + } + http.Post(d.Config.DiscordWebhook, "application/json", bytes.NewBuffer(b)) }