feature

package
v1.261029.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MPL-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package feature holds the remote-control chat features (action menu, bind flow, directory browser) that sit on top of imbot.

This file builds the action menus and confirmation keyboards. Everything in it is platform-neutral — it goes through imbot's keyboard and card builders and never names a platform. It used to be called telegram_keyboard.go, which misdescribed it: the Telegram coupling lives at the call sites that render these into a Telegram payload, not here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildActionKeyboard

func BuildActionKeyboard() *imbot.KeyboardBuilder

BuildActionKeyboard builds the inline keyboard for actions (Clear/Bind)

func BuildCancelKeyboard

func BuildCancelKeyboard() *imbot.KeyboardBuilder

BuildCancelKeyboard builds a simple cancel keyboard

func BuildCreateConfirmKeyboard

func BuildCreateConfirmKeyboard(path string) (*imbot.KeyboardBuilder, string)

BuildCreateConfirmKeyboard builds the confirmation keyboard for creating a directory

func SendDirectoryBrowser

func SendDirectoryBrowser(ctx context.Context, bot imbot.Bot, browser *DirectoryBrowser, chatID string, editMessageID string) (string, error)

SendDirectoryBrowser sends or updates the directory browser message

Types

type BindFlowState

type BindFlowState struct {
	ChatID       string
	CurrentPath  string
	Page         int
	PageSize     int
	MessageID    string // Message ID to edit
	ExpiresAt    time.Time
	WaitingInput bool   // Waiting for custom path input
	PromptMsgID  string // Prompt message ID for cleanup
}

BindFlowState represents the state of an ongoing bind flow.

It used to also cache the directory listing, because a button could not carry a path: Telegram's 64-byte callback_data forced the browser to send array indices and resolve them here. Payload segments carry the path itself now, so the snapshot — and the class of bug where a stale index resolved against a re-listed directory — is gone.

type DirectoryBrowser

type DirectoryBrowser struct {
	// contains filtered or unexported fields
}

DirectoryBrowser manages directory navigation for bind flow

func NewDirectoryBrowser

func NewDirectoryBrowser() *DirectoryBrowser

NewDirectoryBrowser creates a new directory browser

func (*DirectoryBrowser) BuildKeyboard

func (b *DirectoryBrowser) BuildKeyboard(chatID string) (*BindFlowState, *imbot.KeyboardBuilder, string, error)

BuildKeyboard builds the inline keyboard for directory browsing

func (*DirectoryBrowser) Clear

func (b *DirectoryBrowser) Clear(chatID string)

Clear removes the state for a chat

func (*DirectoryBrowser) GetCurrentPath

func (b *DirectoryBrowser) GetCurrentPath(chatID string) string

GetCurrentPath returns the current path for a chat

func (*DirectoryBrowser) GetState

func (b *DirectoryBrowser) GetState(chatID string) *BindFlowState

GetState returns the current state for a chat

func (*DirectoryBrowser) IsWaitingInput

func (b *DirectoryBrowser) IsWaitingInput(chatID string) bool

IsWaitingInput checks if the chat is waiting for custom path input

func (*DirectoryBrowser) Navigate

func (b *DirectoryBrowser) Navigate(chatID string, path string) error

Navigate navigates to a subdirectory

func (*DirectoryBrowser) NavigateUp

func (b *DirectoryBrowser) NavigateUp(chatID string) error

NavigateUp navigates to the parent directory

func (*DirectoryBrowser) NextPage

func (b *DirectoryBrowser) NextPage(chatID string) error

NextPage moves to the next page of directories

func (*DirectoryBrowser) PrevPage

func (b *DirectoryBrowser) PrevPage(chatID string) error

PrevPage moves to the previous page of directories

func (*DirectoryBrowser) SetMessageID

func (b *DirectoryBrowser) SetMessageID(chatID string, messageID string)

SetMessageID sets the message ID for editing

func (*DirectoryBrowser) SetWaitingInput

func (b *DirectoryBrowser) SetWaitingInput(chatID string, waiting bool, promptMsgID string)

SetWaitingInput sets the waiting for input state

func (*DirectoryBrowser) Start

func (b *DirectoryBrowser) Start(chatID string) (*BindFlowState, error)

Start begins a new bind flow for a chat, starting at the home directory.

func (*DirectoryBrowser) StartAt

func (b *DirectoryBrowser) StartAt(chatID, startPath string) (*BindFlowState, error)

StartAt begins a new bind flow for a chat, starting at startPath. If startPath is empty or does not exist, the browser falls back to the home directory so the user always lands somewhere navigable.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL