Documentation
¶
Index ¶
- func AddAccountIDs(params url.Values, accountIDs string)
- func AddCSVParam(params url.Values, key, csv string)
- func ConfirmPrompt(r io.Reader, w io.Writer, prompt string) (bool, error)
- func FilterChats(chats []api.Chat, unreadOnly, mutedOnly, pinnedOnly, archivedOnly bool, ...) []api.Chat
- func FilterUnreadMessages(messages []api.Message, unreadOnly bool) []api.Message
- func FormatMessageLine(m api.Message, otherName string) string
- func FormatTime(t time.Time) string
- func LimitSlice[T any](items []T, limit int) []T
- func LooksLikeChatID(s string) bool
- func MessageDisplayText(m api.Message) string
- func MessageSender(m api.Message) string
- func MessageSenderDisplay(m api.Message, otherName string) string
- func MinInt(a, b int) int
- func NewestSortKey(messages []api.Message) string
- func NormalizeDateAfter(value string) string
- func OldestSortKey(messages []api.Message) string
- func OtherChatName(chat api.Chat) string
- func Poll(ctx context.Context, interval time.Duration, fn func(context.Context) error, ...) error
- func PrintMessageLine(w io.Writer, m api.Message, otherName string)
- func ReadFile(path string) (string, error)
- func ReadStdin(r io.Reader) (string, error)
- func ResolveChatByName(ctx context.Context, client *api.Client, accountIDs string, name string, ...) (string, error)
- func ResolveChatIDFromArgOrFlag(ctx context.Context, client *api.Client, accountIDs string, args []string, ...) (string, error)
- func ResolveChatIDFromFlags(ctx context.Context, client *api.Client, accountIDs string, ...) (string, error)
- func ResolveMessageInput(text string, stdin bool, file string, in io.Reader) (string, error)
- func SenderName(senderID string) string
- func SortMessagesByTime(messages []api.Message) []api.Message
- func TailSlice[T any](items []T, limit int) []T
- func Truncate(s string, max int) string
- type ChatResolveOptions
- type NameFlags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAccountIDs ¶
func AddCSVParam ¶
func FilterChats ¶
func FilterUnreadMessages ¶
func FormatTime ¶
func LimitSlice ¶
func LooksLikeChatID ¶
LooksLikeChatID returns true if the string looks like a chat ID rather than a name.
func MessageDisplayText ¶
func MessageSender ¶
func NewestSortKey ¶
func NormalizeDateAfter ¶
func OldestSortKey ¶
func OtherChatName ¶
func Poll ¶
func Poll(ctx context.Context, interval time.Duration, fn func(context.Context) error, onError func(error) bool) error
Poll runs fn every interval until the context is canceled. If onError is nil, any error from fn stops polling. If onError returns true, polling continues after an error.
func ResolveChatByName ¶
func ResolveChatByName(ctx context.Context, client *api.Client, accountIDs string, name string, opts ChatResolveOptions, warn io.Writer) (string, error)
ResolveChatByName searches for a chat by name and returns its ID. If multiple matches are found, it errors unless First is set.
func ResolveChatIDFromArgOrFlag ¶
func ResolveChatIDFromArgOrFlag(ctx context.Context, client *api.Client, accountIDs string, args []string, flagValue, flagName string, opts ChatResolveOptions, warn io.Writer) (string, error)
ResolveChatIDFromArgOrFlag resolves a chat ID using either a flag value (chat name) or a positional chat ID argument.
func ResolveChatIDFromFlags ¶
func ResolveChatIDFromFlags(ctx context.Context, client *api.Client, accountIDs string, nameFlag, idFlag, nameLabel, idLabel string, opts ChatResolveOptions, warn io.Writer) (string, error)
ResolveChatIDFromFlags resolves a chat ID using either a chat name or explicit chat ID flag.
func ResolveMessageInput ¶
func SenderName ¶
Types ¶
type ChatResolveOptions ¶
Click to show internal directories.
Click to hide internal directories.