change domen
This commit is contained in:
@@ -2,6 +2,7 @@ package screens
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"example.com/m/bot"
|
||||
"github.com/NicoNex/echotron/v3"
|
||||
@@ -43,8 +44,24 @@ type CreativeEditorFields struct {
|
||||
// GetCreativeText возвращает текст для превью креатива
|
||||
func (e *CreativeEditorFields) GetCreativeText() string {
|
||||
if e.Text != nil && *e.Text != "" {
|
||||
// Проверяем что текст не является "визуально пустым" HTML
|
||||
// Например: "<a class=\"tg-link\"></a>" - пустая ссылка
|
||||
text := strings.TrimSpace(*e.Text)
|
||||
|
||||
// Убираем пустые HTML-теги (простая проверка)
|
||||
if text == "<a class=\"tg-link\"></a>" || text == "" {
|
||||
log.Info().Str("text", *e.Text).Msg("GetCreativeText: text is visually empty, using default")
|
||||
return `<i>💭 Я твой креатив
|
||||
|
||||
У меня пока нет текста, добавь его ниже.
|
||||
|
||||
</i>`
|
||||
}
|
||||
|
||||
log.Info().Str("text", *e.Text).Msg("GetCreativeText: returning creative text")
|
||||
return *e.Text
|
||||
}
|
||||
log.Info().Bool("text_is_nil", e.Text == nil).Msg("GetCreativeText: returning default text")
|
||||
return `<i>💭 Я твой креатив
|
||||
|
||||
У меня пока нет текста, добавь его ниже.
|
||||
@@ -136,7 +153,7 @@ func (e *CreativeEditorFields) SendCreativePreview(b *bot.Bot) {
|
||||
}
|
||||
} else {
|
||||
// Отправляем обычное текстовое сообщение напрямую (не через SendNew)
|
||||
// чтобы не обновлять LastMessageID и не затронуть cleanup
|
||||
// чтобы не затронуть LastMessageID и не затронуть cleanup
|
||||
res, err := b.SendMessage(creativeText, b.ChatID, &echotron.MessageOptions{
|
||||
ReplyMarkup: keyboard,
|
||||
ParseMode: echotron.HTML,
|
||||
@@ -319,12 +336,15 @@ func (e *CreativeEditorFields) ShowControlPanel(b *bot.Bot, text string, buttons
|
||||
} else {
|
||||
// Редактируем существующую панель
|
||||
log.Info().Int("control_panel_msg_id", *e.ControlPanelMessageID).Msg("Editing control panel")
|
||||
|
||||
// Временно заменяем LastMessageID на ID панели управления
|
||||
oldLastMessageID := b.LastMessageID
|
||||
b.LastMessageID = *e.ControlPanelMessageID
|
||||
|
||||
keyboard := bot.Keyboard(buttons...)
|
||||
b.Edit(text, keyboard)
|
||||
|
||||
// Восстанавливаем оригинальный LastMessageID
|
||||
b.LastMessageID = oldLastMessageID
|
||||
log.Info().Msg("Control panel updated")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user