From 4f4dff3285d983c6b0bcbb6e29cb105378c6bbfe Mon Sep 17 00:00:00 2001 From: biast12 <53872542+biast12@users.noreply.github.com> Date: Sun, 30 Aug 2026 14:56:33 +0200 Subject: [PATCH] Fix: Voting premium removes the branding footer without unlocking a custom one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `BuildCustomEmbed` treated "not free" as "may use a custom footer", so a voting server got both no branding *and* its own footer. `branding bool` becomes `FooterPolicy{ShowBranding, AllowCustom}`: - no premium → branding footer - voting premium → no footer at all - paid premium → custom footer --- bot/command/impl/tags/tag.go | 2 +- bot/command/impl/tags/tagalias.go | 2 +- bot/logic/welcomemessage.go | 28 ++++++++++++++++++++++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/bot/command/impl/tags/tag.go b/bot/command/impl/tags/tag.go index 9d7721cc..e4a9e195 100644 --- a/bot/command/impl/tags/tag.go +++ b/bot/command/impl/tags/tag.go @@ -91,7 +91,7 @@ func (TagCommand) Execute(ctx registry.CommandContext, tagId string) { var embeds []*embed.Embed if tag.Embed != nil { embeds = []*embed.Embed{ - logic.BuildCustomEmbed(ctx, ctx.Worker(), ticket, *tag.Embed.CustomEmbed, tag.Embed.Fields, false, nil), + logic.BuildCustomEmbed(ctx, ctx.Worker(), ticket, *tag.Embed.CustomEmbed, tag.Embed.Fields, logic.FooterPolicy{AllowCustom: true}, nil), } } diff --git a/bot/command/impl/tags/tagalias.go b/bot/command/impl/tags/tagalias.go index 3ad424d0..8e39a4ed 100644 --- a/bot/command/impl/tags/tagalias.go +++ b/bot/command/impl/tags/tagalias.go @@ -74,7 +74,7 @@ func (c TagAliasCommand) Execute(ctx registry.CommandContext) { var embeds []*embed.Embed if c.tag.Embed != nil { embeds = []*embed.Embed{ - logic.BuildCustomEmbed(ctx, ctx.Worker(), ticket, *c.tag.Embed.CustomEmbed, c.tag.Embed.Fields, false, nil), + logic.BuildCustomEmbed(ctx, ctx.Worker(), ticket, *c.tag.Embed.CustomEmbed, c.tag.Embed.Fields, logic.FooterPolicy{AllowCustom: true}, nil), } } diff --git a/bot/logic/welcomemessage.go b/bot/logic/welcomemessage.go index 0b8a00ea..32a2ed4e 100644 --- a/bot/logic/welcomemessage.go +++ b/bot/logic/welcomemessage.go @@ -10,6 +10,7 @@ import ( "sync" "time" + "github.com/TicketsBot-cloud/common/model" "github.com/TicketsBot-cloud/common/premium" "github.com/TicketsBot-cloud/common/sentry" "github.com/TicketsBot-cloud/database" @@ -145,7 +146,7 @@ func BuildWelcomeMessageEmbed( return nil, err } - e := BuildCustomEmbed(ctx, cmd.Worker(), ticket, data, fields, cmd.PremiumTier() == premium.None, additionalPlaceholders) + e := BuildCustomEmbed(ctx, cmd.Worker(), ticket, data, fields, FooterPolicyForContext(ctx, cmd), additionalPlaceholders) return e, nil } } @@ -709,12 +710,31 @@ func truncateRunes(s string, limit int) string { return string(runes[:limit]) } +type FooterPolicy struct { + ShowBranding bool + AllowCustom bool +} + +func FooterPolicyForContext(ctx context.Context, cmd registry.CommandContext) FooterPolicy { + if cmd.PremiumTier() == premium.None { + return FooterPolicy{ShowBranding: true} + } + + _, source, err := utils.PremiumClient.GetTierByGuildIdWithSource(ctx, cmd.GuildId(), cmd.Worker().Token, cmd.Worker().RateLimiter) + if err != nil { + sentry.Error(err) + return FooterPolicy{AllowCustom: true} + } + + return FooterPolicy{AllowCustom: source != model.EntitlementSourceVoting} +} + func BuildCustomEmbed( ctx context.Context, worker *worker.Context, ticket database.Ticket, customEmbed database.CustomEmbed, fields []database.EmbedField, - branding bool, + footer FooterPolicy, // Only custom integration placeholders for now - prevent making duplicate requests additionalPlaceholders map[string]string, ) *embed.Embed { @@ -746,9 +766,9 @@ func BuildCustomEmbed( Color: int(customEmbed.Colour), } - if branding { + if footer.ShowBranding { e.SetFooter(fmt.Sprintf("Powered by %s", config.Conf.Bot.PoweredBy), config.Conf.Bot.IconUrl) - } else if customEmbed.FooterText != nil { + } else if footer.AllowCustom && customEmbed.FooterText != nil { e.SetFooter( plainTextSubstitute(*customEmbed.FooterText, embedFooterTextLimit), resolveAvatarUrl(utils.ValueOrZero(customEmbed.FooterIconUrl)),