From 2521fd8860feb799478f28e9d2847dc5fdaca888 Mon Sep 17 00:00:00 2001 From: Astra Date: Fri, 30 Jan 2026 13:32:38 +0000 Subject: [PATCH] actually send decline reason if starts with "+" --- main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 838374e..9ff666b 100644 --- a/main.go +++ b/main.go @@ -81,18 +81,18 @@ func main() { lines := strings.Split(repliedMsg.Text, "\n") if strings.TrimPrefix(lines[3], "Declined by: ") == update.Message.From.String() { reason := escapeHTML(update.Message.Text) - if after, ok := strings.CutPrefix(update.Message.Text, "+"); ok { - reason = escapeHTML(after) - } userID, username, joinReason, declinedBy, declinedAt := GetInfoFromMsg(repliedMsg.Text) + if strings.HasPrefix(update.Message.Text, "+") { + reason = escapeHTML(update.Message.Text[1:]) + m := api.NewMessage(userID, fmt.Sprintf("Your join request was declined for the following reason:\n\n%s", + reason)) + b.API.Send(m) + } edit := api.NewEditMessageText(b.Config.AdminChatId, repliedMsg.MessageID, fmt.Sprintf(AdminDeclinedMsg, username, userID, joinReason, declinedBy, declinedAt, reason)) edit.ParseMode = api.ModeHTML b.API.Send(edit) - m := api.NewMessage(userID, fmt.Sprintf("Your join request was declined for the following reason:\n\n%s", - update.Message.Text)) - b.API.Send(m) } } }