закуп много каналов

This commit is contained in:
Artem Tsyrulnikov
2026-01-04 18:06:12 +03:00
parent 9637f6ec3a
commit 5251ec3015
7 changed files with 115 additions and 15 deletions

View File

@@ -85,7 +85,7 @@ https://t.me/+AbCdEfGhIjKlMn</i>`, [][]echotron.InlineKeyboardButton{
// Начинаем процесс добавления медиа
s.WaitingForMedia = true
s.ShowControlPanel(b, `<b> Добавить медиа</b>
s.ShowControlPanel(b, `<b> Добавить медиа</b>
Отправьте <b>фото, видео или GIF</b>

View File

@@ -116,7 +116,7 @@ https://t.me/+AbCdEfGhIjKlMn</i>`, [][]echotron.InlineKeyboardButton{
case data == "add_media":
s.WaitingForMedia = true
s.ShowControlPanel(b, `<b> Добавить медиа</b>
s.ShowControlPanel(b, `<b> Добавить медиа</b>
Отправьте <b>фото, видео или GIF</b>

View File

@@ -283,7 +283,7 @@ func (e *CreativeEditorFields) ShowManagementPanel(b *bot.Bot, confirmButtonText
// Блок редактирования контента
buttons = append(buttons, bot.Row(
bot.Button("✎ Текст", "edit_text"),
bot.Button(" Медиа", "add_media"),
bot.Button(" Медиа", "add_media"),
))
// Добавление кнопки сразу под основным блоком
buttons = append(buttons, bot.Row(bot.Button(" Добавить кнопку", "add_button")))

View File

@@ -38,12 +38,34 @@ func (s *MyProjects) Enter(b *bot.Bot, mode bot.RenderMode) {
}
if len(workspaces) == 0 {
b.SendNew("У вас пока нет workspace'ов", bot.Keyboard())
return
}
// Автоматически создаем workspace с именем пользователя
username := "My Workspace"
chatInfo, err := b.GetChat(b.ChatID)
if err == nil && chatInfo.Result != nil {
if chatInfo.Result.Username != "" {
username = chatInfo.Result.Username
} else if chatInfo.Result.FirstName != "" {
username = chatInfo.Result.FirstName
if chatInfo.Result.LastName != "" {
username += " " + chatInfo.Result.LastName
}
}
}
// Используем первый workspace по умолчанию
s.WorkspaceID = workspaces[0].ID
log.Info().Str("username", username).Msg("Creating default workspace")
workspace, err := b.Backend.CreateWorkspace(context.Background(), jwt, username)
if err != nil {
log.Error().Err(err).Msg("Failed to create workspace")
b.SendNew("❌ Не удалось создать workspace", bot.Keyboard())
return
}
s.WorkspaceID = workspace.ID
log.Info().Str("workspace_id", s.WorkspaceID).Str("name", workspace.Name).Msg("Workspace created successfully")
} else {
// Используем первый workspace по умолчанию
s.WorkspaceID = workspaces[0].ID
}
}
s.renderProjects(b, mode, jwt)

View File

@@ -570,9 +570,9 @@ func (s *PurchaseOptionalDetails) renderParamChannels(b *bot.Bot, mode bot.Rende
label := fmt.Sprintf("%d", i+1)
rows = append(rows, bot.Row(
bot.Button(label, fmt.Sprintf("param_edit:%s:%d", param, i)),
bot.Button("", fmt.Sprintf("param_copy:%s:%d", param, i)),
bot.Button("", fmt.Sprintf("param_paste:%s:%d", param, i)),
bot.Button("", fmt.Sprintf("param_edit:%s:%d", param, i)),
bot.Button("", fmt.Sprintf("param_copy:%s:%d", param, i)),
bot.Button("", fmt.Sprintf("param_paste:%s:%d", param, i)),
bot.Button("Изменить", fmt.Sprintf("param_edit:%s:%d", param, i)),
bot.Button("⌫", fmt.Sprintf("param_clear:%s:%d", param, i)),
))
}
@@ -630,7 +630,8 @@ func (s *PurchaseOptionalDetails) handleParamCallback(b *bot.Bot, data string) b
case strings.HasPrefix(data, "param_edit:"):
param, index, ok := s.parseParamIndex(data, "param_edit:")
if !ok {
return false
s.Enter(b, bot.EditMessage)
return true
}
if index >= 0 && index < len(s.Channels) {
s.CurrentParam = param
@@ -638,10 +639,13 @@ func (s *PurchaseOptionalDetails) handleParamCallback(b *bot.Bot, data string) b
s.openChannelEditor(b, param, s.CurrentChannel)
return true
}
s.Enter(b, bot.EditMessage)
return true
case strings.HasPrefix(data, "param_copy:"):
param, index, ok := s.parseParamIndex(data, "param_copy:")
if !ok {
return false
s.Enter(b, bot.EditMessage)
return true
}
if index >= 0 && index < len(s.Channels) {
username := s.Channels[index].Username
@@ -649,10 +653,13 @@ func (s *PurchaseOptionalDetails) handleParamCallback(b *bot.Bot, data string) b
s.Enter(b, bot.EditMessage)
return true
}
s.Enter(b, bot.EditMessage)
return true
case strings.HasPrefix(data, "param_paste:"):
param, index, ok := s.parseParamIndex(data, "param_paste:")
if !ok {
return false
s.Enter(b, bot.EditMessage)
return true
}
if index >= 0 && index < len(s.Channels) {
username := s.Channels[index].Username
@@ -660,10 +667,13 @@ func (s *PurchaseOptionalDetails) handleParamCallback(b *bot.Bot, data string) b
s.Enter(b, bot.EditMessage)
return true
}
s.Enter(b, bot.EditMessage)
return true
case strings.HasPrefix(data, "param_clear:"):
param, index, ok := s.parseParamIndex(data, "param_clear:")
if !ok {
return false
s.Enter(b, bot.EditMessage)
return true
}
if index >= 0 && index < len(s.Channels) {
username := s.Channels[index].Username
@@ -671,6 +681,8 @@ func (s *PurchaseOptionalDetails) handleParamCallback(b *bot.Bot, data string) b
s.Enter(b, bot.EditMessage)
return true
}
s.Enter(b, bot.EditMessage)
return true
case strings.HasPrefix(data, "param_apply_all:"):
param := strings.TrimPrefix(data, "param_apply_all:")
s.applyParamToAll(param)