Update telegram-join-approval-bot submodule and apply patches

This commit is contained in:
Astra 2026-03-11 09:23:38 +00:00
parent 394c520e6f
commit 67ce076a7c
2 changed files with 29 additions and 28 deletions

View file

@ -76,33 +76,6 @@ func (bot *Bot) handleApproveRequest(query *api.CallbackQuery, user *ExtendedCha
return
}
utils.EditMessage(bot.API, query.Message.Chat.ID, query.Message.MessageID,
fmt.Sprintf(AdminApprovedMsg,
userString, user.From.ID, user.JoinReason, adminUserString,
time.Now().Format("2006-01-02 15:04:05"),
),
)
if bot.Config.SendApprovalMessage {
utils.SendMessage(bot.API, user.From.ID, 0, bot.Config.ApprovalMessage)
}
bot.API.Request(api.NewCallback(query.ID, "Join request approved."))
}
// handleDeclineRequest declines a join request and sends a decline callback.
func (bot *Bot) handleDeclineRequest(query *api.CallbackQuery, user *ExtendedChatJoinRequest, userString, adminUserString string) {
r := api.DeclineChatJoinRequest{
ChatConfig: api.ChatConfig{ChatID: user.ChatJoinRequest.Chat.ID},
UserID: user.ChatJoinRequest.From.ID,
}
if _, err := bot.API.Request(r); err != nil {
log.Println(err)
bot.restoreMessage(query)
return
}
messageText := fmt.Sprintf(AdminDeclinedMsg,
userString, user.From.ID, user.JoinReason, adminUserString,
time.Now().Format("2006-01-02 15:04:05"),
@ -136,6 +109,34 @@ func (bot *Bot) handleDeclineRequest(query *api.CallbackQuery, user *ExtendedCha
bot.API.Send(edit)
if bot.Config.SendApprovalMessage {
utils.SendMessage(bot.API, user.From.ID, 0, bot.Config.ApprovalMessage)
}
bot.API.Request(api.NewCallback(query.ID, "Join request approved."))
}
// handleDeclineRequest declines a join request and sends a decline callback.
func (bot *Bot) handleDeclineRequest(query *api.CallbackQuery, user *ExtendedChatJoinRequest, userString, adminUserString string) {
r := api.DeclineChatJoinRequest{
ChatConfig: api.ChatConfig{ChatID: user.ChatJoinRequest.Chat.ID},
UserID: user.ChatJoinRequest.From.ID,
}
if _, err := bot.API.Request(r); err != nil {
log.Println(err)
bot.restoreMessage(query)
return
}
utils.EditMessage(bot.API, query.Message.Chat.ID, query.Message.MessageID,
fmt.Sprintf(AdminDeclinedMsg,
userString, user.From.ID, user.JoinReason, adminUserString,
time.Now().Format("2006-01-02 15:04:05"),
defaultReason,
),
)
bot.API.Request(api.NewCallback(query.ID, "Join request declined."))
}