From 679b4bd1572e6721a4817b4501626c23f909d2cc Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Fri, 11 Oct 2024 10:22:21 -0600 Subject: [PATCH] connector/reactions: fallback to sensible defaults if config doesn't have the correct values Signed-off-by: Sumner Evans --- pkg/connector/reactions.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/connector/reactions.go b/pkg/connector/reactions.go index 3f380c1d..4e566e47 100644 --- a/pkg/connector/reactions.go +++ b/pkg/connector/reactions.go @@ -184,8 +184,16 @@ func (t *TelegramClient) getReactionLimit(ctx context.Context, sender networkid. return 0, err } if ghost.Metadata.(*GhostMetadata).IsPremium { - return int(config["reactions_user_max_premium"].(float64)), nil + if maxReactions, ok := config["reactions_user_max_premium"].(float64); ok { + return int(maxReactions), nil + } else { + return 3, nil + } } else { - return int(config["reactions_user_max_default"].(float64)), nil + if maxReactions, ok := config["reactions_user_max_default"].(float64); ok { + return int(maxReactions), nil + } else { + return 1, nil + } } }