кастомный echotron + fix текста
This commit is contained in:
@@ -5,6 +5,7 @@ WORKDIR /app/tg_bot
|
||||
# Modules layer
|
||||
COPY tg_bot/go.mod tg_bot/go.sum ./
|
||||
COPY pkg /app/pkg
|
||||
COPY shared/echotron /app/shared/echotron
|
||||
RUN go mod download
|
||||
|
||||
# Build layer
|
||||
|
||||
@@ -17,3 +17,5 @@ require (
|
||||
)
|
||||
|
||||
replace github.com/TelegramExchange/pkg => ../pkg
|
||||
|
||||
replace github.com/NicoNex/echotron/v3 => ../shared/echotron
|
||||
|
||||
@@ -30,7 +30,7 @@ func (s *AddProject) Enter(b *bot.Bot, mode bot.RenderMode) {
|
||||
addBotURL := fmt.Sprintf("https://t.me/%s?startchannel&admin=invite_users+post_messages+edit_messages+delete_messages", botUsername)
|
||||
|
||||
buttons := [][]echotron.InlineKeyboardButton{
|
||||
Row(URLButton("Назначить администратором", addBotURL)),
|
||||
Row(Stylish(URLButton("Назначить администратором", addBotURL), echotron.DangerButtonStyle)),
|
||||
Row(Button("← Назад", "back")),
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,12 @@ func Button(text, data string) echotron.InlineKeyboardButton {
|
||||
}
|
||||
}
|
||||
|
||||
func Stylish(btn echotron.InlineKeyboardButton, style echotron.ButtonStyle) echotron.InlineKeyboardButton {
|
||||
btn.Style = style
|
||||
|
||||
return btn
|
||||
}
|
||||
|
||||
func URLButton(text, url string) echotron.InlineKeyboardButton {
|
||||
return echotron.InlineKeyboardButton{
|
||||
Text: text,
|
||||
|
||||
@@ -319,8 +319,8 @@ func (s *PurchaseOptionalDetails) HandleCallback(b *bot.Bot, u *echotron.Update)
|
||||
value := strings.TrimPrefix(u.CallbackQuery.Data, "type:")
|
||||
// Нормализуем значение для БД
|
||||
switch value {
|
||||
case "self_promo":
|
||||
s.PurchaseType = "самопиар"
|
||||
case "mutual_pr":
|
||||
s.PurchaseType = "взаимный пиар"
|
||||
case "standard":
|
||||
s.PurchaseType = "стандарт"
|
||||
}
|
||||
@@ -635,7 +635,7 @@ func (s *PurchaseOptionalDetails) renderInputPrompt(b *bot.Bot, mode bot.RenderM
|
||||
case "type":
|
||||
text += "<b>Выберите тип закупа</b>"
|
||||
keyboard := Keyboard(
|
||||
Row(Button("Самопиар", "type:self_promo"), Button("Стандарт", "type:standard")),
|
||||
Row(Button("Взаимный пиар", "type:mutual_pr"), Button("Стандарт", "type:standard")),
|
||||
Row(Button("← Назад", "back_to_optional")),
|
||||
)
|
||||
if mode == bot.EditMessage {
|
||||
@@ -2363,8 +2363,8 @@ func (s *PurchaseOptionalDetails) normalizePurchaseType() (*string, bool) {
|
||||
normalized := strings.ToLower(raw)
|
||||
normalized = strings.TrimSpace(strings.Trim(normalized, "."))
|
||||
switch normalized {
|
||||
case "самопиар", "само пиар", "self_promo", "self promo", "вп", "vp":
|
||||
value := "self_promo"
|
||||
case "взаимный пиар", "взаимнопиар", "mutual_pr", "mutual pr", "вп", "vp":
|
||||
value := "mutual_pr"
|
||||
return &value, true
|
||||
case "стандарт", "standard":
|
||||
value := "standard"
|
||||
|
||||
Reference in New Issue
Block a user