33 рядки
824 B
Go
33 рядки
824 B
Go
package list
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"git.entityseven.com/rilaxik/pllist/internal/domain"
|
|
"git.entityseven.com/rilaxik/pllist/internal/telegram/shared"
|
|
)
|
|
|
|
const (
|
|
deleteText = `Delete this list? This cannot be undone.`
|
|
titlePrompt = "Send the list title (1-120 characters). /cancel to stop."
|
|
renameTitlePrompt = "Send the new list title (1-120 characters). /cancel to stop."
|
|
)
|
|
|
|
func listsText(lists []domain.List, userID int64) string {
|
|
if len(lists) == 0 {
|
|
return "<b>Your lists</b>\n\nNo lists yet. Create one with /new."
|
|
}
|
|
|
|
var text strings.Builder
|
|
text.WriteString("<b>Your lists</b>\n\n")
|
|
for _, list := range lists {
|
|
role := "shared"
|
|
if list.OwnerID == userID {
|
|
role = "owner"
|
|
}
|
|
fmt.Fprintf(&text, "• %s — %s\n", shared.Escape(list.Title), role)
|
|
}
|
|
return text.String()
|
|
}
|