stream

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 10 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunningKeyboard

func RunningKeyboard() *models.InlineKeyboardMarkup

RunningKeyboard is the [Cancel] [Kill] inline keyboard attached to the live-streaming message for a running command. Data handled by the telegram/callbacks package under ns.Job.

Types

type Config

type Config struct {
	EditInterval    time.Duration
	MaxMessageChars int
}

type Streamer

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

func New

func New(b *bot.Bot, cfg Config, log *zap.Logger) *Streamer

func (*Streamer) ActionLoop

func (s *Streamer) ActionLoop(ctx context.Context, chatID int64, action models.ChatAction)

ActionLoop sends `action` immediately, then refreshes every ~4s until ctx cancels. Exposed so command handlers can show the "sending a file" status during /get and /audit-out transfers.

func (*Streamer) Stream

func (s *Streamer) Stream(ctx context.Context, chatID int64, j *shell.Job)

Stream drives the Telegram UI for a single job:

  • Posts a placeholder message and edits it live every `edit_interval`.
  • Shows "… is typing" throughout.
  • When the current message would exceed Telegram's cap, finalizes it at a clean boundary (last `\n`, fallback to space, fallback to hard cut) and rolls to a new message.
  • On completion, if output spanned more than one message, swaps to the "sending a file" indicator and uploads the full combined output as `output-<unix-ts>.txt`.

Jump to

Keyboard shortcuts

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