From 8c61d0be23b38933e87019e2db61b6a0e7d155de Mon Sep 17 00:00:00 2001 From: AK Date: Sat, 8 Aug 2026 02:30:47 -0700 Subject: [PATCH] fix: color only golden duck label --- plugins/duckhunt.go | 2 +- plugins/duckhunt_test.go | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/duckhunt.go b/plugins/duckhunt.go index b1b7904..55b0f4e 100644 --- a/plugins/duckhunt.go +++ b/plugins/duckhunt.go @@ -1721,7 +1721,7 @@ func xpToNextLevel(xp int64) int64 { func duckName(state *duckHuntState) string { if state != nil && state.golden { - return ircColor(ircYellow, "the GOLDEN DUCK") + return "the " + ircColor(ircYellow, "GOLDEN DUCK") } if state != nil && state.flockRemaining > 1 { return ircColor(ircCyan, "a duck in the flock") diff --git a/plugins/duckhunt_test.go b/plugins/duckhunt_test.go index f0d0937..bd76d82 100644 --- a/plugins/duckhunt_test.go +++ b/plugins/duckhunt_test.go @@ -307,6 +307,17 @@ func TestDuckHuntAnnouncementKeepsDuckASCIICompact(t *testing.T) { } } +func TestDuckHuntGoldenDuckColorStartsAtLabel(t *testing.T) { + got := duckName(&duckHuntState{golden: true}) + want := "the " + ircColor(ircYellow, "GOLDEN DUCK") + if got != want { + t.Fatalf("golden duck name = %q, want %q", got, want) + } + if strings.HasPrefix(got, ircYellow) { + t.Fatal("the article must not be yellow") + } +} + func TestDuckHuntSchedulesAfterActivityThreshold(t *testing.T) { plugin := &DuckHunt{} if err := plugin.Init(bot.PluginConfig{