actually send decline reason if starts with "+"
This commit is contained in:
parent
71b12970df
commit
2521fd8860
1 changed files with 6 additions and 6 deletions
12
main.go
12
main.go
|
|
@ -81,18 +81,18 @@ func main() {
|
||||||
lines := strings.Split(repliedMsg.Text, "\n")
|
lines := strings.Split(repliedMsg.Text, "\n")
|
||||||
if strings.TrimPrefix(lines[3], "Declined by: ") == update.Message.From.String() {
|
if strings.TrimPrefix(lines[3], "Declined by: ") == update.Message.From.String() {
|
||||||
reason := escapeHTML(update.Message.Text)
|
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)
|
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,
|
edit := api.NewEditMessageText(b.Config.AdminChatId, repliedMsg.MessageID,
|
||||||
fmt.Sprintf(AdminDeclinedMsg,
|
fmt.Sprintf(AdminDeclinedMsg,
|
||||||
username, userID, joinReason, declinedBy, declinedAt, reason))
|
username, userID, joinReason, declinedBy, declinedAt, reason))
|
||||||
edit.ParseMode = api.ModeHTML
|
edit.ParseMode = api.ModeHTML
|
||||||
b.API.Send(edit)
|
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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue