actually send decline reason if starts with "+"

This commit is contained in:
Astra 2026-01-30 13:32:38 +00:00
parent 71b12970df
commit 2521fd8860

12
main.go
View file

@ -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)
}
}
}