Update patch file
This commit is contained in:
parent
5d97a5f593
commit
394c520e6f
1 changed files with 23 additions and 12 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
--- a/config/config.go
|
--- a/config/config.go
|
||||||
+++ b/config/config.go
|
+++ b/config/config.go
|
||||||
@@ -8,14 +8,15 @@ import (
|
@@ -8,14 +8,15 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) LoadConfig() error {
|
func (c *Config) LoadConfig() error {
|
||||||
@@ -47,6 +48,7 @@ func (c *Config) CreateConfig() error {
|
@@ -47,6 +48,7 @@
|
||||||
ApprovalMessage: "",
|
ApprovalMessage: "",
|
||||||
SendApprovalMessage: false,
|
SendApprovalMessage: false,
|
||||||
DeleteRequestAfterDecision: false,
|
DeleteRequestAfterDecision: false,
|
||||||
|
|
@ -32,10 +32,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
encoder := yaml.NewEncoder(f)
|
encoder := yaml.NewEncoder(f)
|
||||||
|
|
||||||
--- a/handlers/callbacks.go
|
--- a/handlers/callbacks.go
|
||||||
+++ b/handlers/callbacks.go
|
+++ b/handlers/callbacks.go
|
||||||
@@ -36,6 +36,7 @@ func (bot *Bot) HandleCallbackQuery(query *api.CallbackQuery) {
|
@@ -36,6 +36,7 @@
|
||||||
switch action {
|
switch action {
|
||||||
case "approve":
|
case "approve":
|
||||||
bot.handleApproveRequest(query, user, userString, adminUserString)
|
bot.handleApproveRequest(query, user, userString, adminUserString)
|
||||||
|
|
@ -43,7 +42,7 @@
|
||||||
case "decline":
|
case "decline":
|
||||||
bot.handleDeclineRequest(query, user, userString, adminUserString)
|
bot.handleDeclineRequest(query, user, userString, adminUserString)
|
||||||
case "ban":
|
case "ban":
|
||||||
@@ -44,10 +45,19 @@ func (bot *Bot) HandleCallbackQuery(query *api.CallbackQuery) {
|
@@ -44,10 +45,19 @@
|
||||||
return
|
return
|
||||||
case "banc":
|
case "banc":
|
||||||
bot.handleBanRequest(query, user, userString, adminUserString)
|
bot.handleBanRequest(query, user, userString, adminUserString)
|
||||||
|
|
@ -65,7 +64,7 @@
|
||||||
if bot.Config.DeleteRequestAfterDecision {
|
if bot.Config.DeleteRequestAfterDecision {
|
||||||
go bot.scheduleMessageDeletion(query.Message.Chat.ID, query.Message.MessageID, 10*time.Second)
|
go bot.scheduleMessageDeletion(query.Message.Chat.ID, query.Message.MessageID, 10*time.Second)
|
||||||
}
|
}
|
||||||
@@ -93,14 +103,39 @@ func (bot *Bot) handleDeclineRequest(query *api.CallbackQuery, user *ExtendedCha
|
@@ -93,14 +103,39 @@
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,7 +110,7 @@
|
||||||
bot.API.Request(api.NewCallback(query.ID, "Join request declined."))
|
bot.API.Request(api.NewCallback(query.ID, "Join request declined."))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,12 +210,14 @@ func (bot *Bot) HandleDeclineReason(update *api.Update) {
|
@@ -175,12 +210,14 @@
|
||||||
userID, username, joinReason, declinedBy, declinedAt := utils.GetInfoFromMsg(repliedMsg.Text)
|
userID, username, joinReason, declinedBy, declinedAt := utils.GetInfoFromMsg(repliedMsg.Text)
|
||||||
|
|
||||||
reason := utils.EscapeHTML(update.Message.Text)
|
reason := utils.EscapeHTML(update.Message.Text)
|
||||||
|
|
@ -128,7 +127,7 @@
|
||||||
utils.EditMessage(bot.API, update.Message.Chat.ID, repliedMsg.MessageID,
|
utils.EditMessage(bot.API, update.Message.Chat.ID, repliedMsg.MessageID,
|
||||||
fmt.Sprintf(AdminDeclinedMsg, username, userID, joinReason, declinedBy, declinedAt, reason))
|
fmt.Sprintf(AdminDeclinedMsg, username, userID, joinReason, declinedBy, declinedAt, reason))
|
||||||
|
|
||||||
@@ -188,6 +225,26 @@ func (bot *Bot) HandleDeclineReason(update *api.Update) {
|
@@ -188,6 +225,26 @@
|
||||||
bot.API.Send(api.NewDeleteMessage(update.Message.Chat.ID, update.Message.MessageID))
|
bot.API.Send(api.NewDeleteMessage(update.Message.Chat.ID, update.Message.MessageID))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,10 +154,10 @@
|
||||||
// parseCallbackData parses the action and user ID from a callback query's data string.
|
// parseCallbackData parses the action and user ID from a callback query's data string.
|
||||||
func parseCallbackData(data string) (action string, userID int64, err error) {
|
func parseCallbackData(data string) (action string, userID int64, err error) {
|
||||||
normalized := strings.Join(strings.Split(data, "_"), " ")
|
normalized := strings.Join(strings.Split(data, "_"), " ")
|
||||||
|
--- a/handlers/handlers.go 2026-03-10
|
||||||
|
+++ b/handlers/handlers.go 2026-03-11
|
||||||
|
|
||||||
--- a/handlers/handlers.go
|
@@ -13,7 +13,7 @@
|
||||||
+++ b/handlers/handlers.go
|
|
||||||
@@ -13,7 +13,7 @@ const (
|
|
||||||
AdminDeclinedMsg = "❌ Join #request declined for %s [<code>%d</code>]\n\n<b>Join reason</b>: %s\n<b>Declined by</b>: %s\n<b>Declined at</b>: %s\n<b>Declined reason</b>: %s"
|
AdminDeclinedMsg = "❌ Join #request declined for %s [<code>%d</code>]\n\n<b>Join reason</b>: %s\n<b>Declined by</b>: %s\n<b>Declined at</b>: %s\n<b>Declined reason</b>: %s"
|
||||||
AdminBannedMsg = "🚫 Join #request banned for %s [<code>%d</code>]\n\n<b>Join reason</b>: %s\n<b>Banned by</b>: %s\n<b>Banned at</b>: %s\n<b>Banned until</b>: %s"
|
AdminBannedMsg = "🚫 Join #request banned for %s [<code>%d</code>]\n\n<b>Join reason</b>: %s\n<b>Banned by</b>: %s\n<b>Banned at</b>: %s\n<b>Banned until</b>: %s"
|
||||||
AdminFailedMsg = "⚠️ Join #request failed for %s [<code>%d</code>]\n\n<b>Join reason</b>: %s\n<b>Failure reason</b>: %s"
|
AdminFailedMsg = "⚠️ Join #request failed for %s [<code>%d</code>]\n\n<b>Join reason</b>: %s\n<b>Failure reason</b>: %s"
|
||||||
|
|
@ -167,3 +166,15 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
// Types shared by handler files
|
// Types shared by handler files
|
||||||
|
diff -ruN '--exclude=.git' '--exclude=.gitmodules' '--exclude=telegram-join-approval-bot' telegram-join-approval-bot/pkg/utils/utils.go telegram-join-approval-nuzzles/pkg/utils/utils.go
|
||||||
|
--- a/pkg/utils/utils.go 2026-03-10
|
||||||
|
+++ b/pkg/utils/utils.go 2026-03-11
|
||||||
|
@@ -38,7 +38,7 @@
|
||||||
|
func NewApprovalKeyboard(userID int64) api.InlineKeyboardMarkup {
|
||||||
|
approveBtn := api.NewInlineKeyboardButtonData("Approve", fmt.Sprintf("approve_%d", userID))
|
||||||
|
declineBtn := api.NewInlineKeyboardButtonData("Decline", fmt.Sprintf("decline_%d", userID))
|
||||||
|
- banBtn := api.NewInlineKeyboardButtonData("Ban", fmt.Sprintf("ban_%d", userID))
|
||||||
|
+ banBtn := api.NewInlineKeyboardButtonData("Ban (24h)", fmt.Sprintf("ban_%d", userID))
|
||||||
|
return api.NewInlineKeyboardMarkup(
|
||||||
|
[]api.InlineKeyboardButton{approveBtn, declineBtn},
|
||||||
|
[]api.InlineKeyboardButton{banBtn},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue