Apply patch
This commit is contained in:
parent
f9eabae404
commit
334fe2bf8f
4 changed files with 40 additions and 3 deletions
|
|
@ -19,6 +19,10 @@ func (bot *Bot) HandleJoinRequestResponse(user *ExtendedChatJoinRequest, update
|
|||
userString := utils.BuildUserString(&user.From)
|
||||
|
||||
keyboard := utils.NewApprovalKeyboard(user.From.ID)
|
||||
if bot.Config.ReminderMessage != "" {
|
||||
newButton := api.NewInlineKeyboardButtonData("Send Reminder", fmt.Sprintf("remind_%d", user.From.ID))
|
||||
keyboard.InlineKeyboard[1] = append([]api.InlineKeyboardButton{newButton}, keyboard.InlineKeyboard[1]...)
|
||||
}
|
||||
utils.EditMessageWithKeyboard(bot.API, *bot.Config.AdminChatId, user.JoinRequestMessageID,
|
||||
fmt.Sprintf(AdminJoinRequestMsg, userString, user.From.ID, user.JoinReason), &keyboard)
|
||||
|
||||
|
|
@ -27,12 +31,24 @@ func (bot *Bot) HandleJoinRequestResponse(user *ExtendedChatJoinRequest, update
|
|||
|
||||
// HandleJoinRequest initiates the join approval flow by sending the entry message and admin notification.
|
||||
func (bot *Bot) HandleJoinRequest(request *api.ChatJoinRequest) {
|
||||
// Check if user already has a pending request
|
||||
if existingUser := bot.GetPendingUser(request.From.ID); existingUser != nil {
|
||||
utils.SendMessage(bot.API, request.From.ID, 0,
|
||||
"You have already requested to join. Please send a single message as your join reason.")
|
||||
return
|
||||
}
|
||||
|
||||
utils.SendMessage(bot.API, request.From.ID, 0, bot.Config.EntryMessage)
|
||||
userString := utils.BuildUserString(&request.From)
|
||||
|
||||
keyboard := utils.NewApprovalKeyboard(request.From.ID)
|
||||
if bot.Config.ReminderMessage != "" {
|
||||
newButton := api.NewInlineKeyboardButtonData("Send Reminder", fmt.Sprintf("remind_%d", request.From.ID))
|
||||
keyboard.InlineKeyboard[1] = append([]api.InlineKeyboardButton{newButton}, keyboard.InlineKeyboard[1]...)
|
||||
}
|
||||
m := api.NewMessage(*bot.Config.AdminChatId,
|
||||
fmt.Sprintf(AdminJoinRequestMsg, userString, request.From.ID, "(awaiting user response)"))
|
||||
m.ReplyMarkup = utils.NewApprovalKeyboard(request.From.ID)
|
||||
m.ReplyMarkup = keyboard
|
||||
m.ParseMode = api.ModeHTML
|
||||
m.LinkPreviewOptions = api.LinkPreviewOptions{IsDisabled: true}
|
||||
if topic := *bot.Config.AdminChatTopicId; topic != 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue