files

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: 12 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 Receive

func Receive(ctx context.Context, b *bot.Bot, doc *models.Document, caption string, cwd string, chown *ChownTo) (string, int64, error)

Receive downloads a Telegram document to `<cwd>/<filename>` (or under a relative subpath if the message caption gives one). The final destination MUST resolve inside cwd — captions with absolute paths or `..` escapes are rejected. O_NOFOLLOW is used on the final open to prevent a malicious final-component symlink from redirecting the write. When `chown` is non-nil, the saved file is chowned to those uid/gid (used to make uploads readable/writable for non-root user shells).

func Send

func Send(ctx context.Context, b *bot.Bot, chatID int64, path string) (int64, error)

Send reads path and uploads it to the chat as a document. Returns the byte size that was sent on success.

func SendBytes

func SendBytes(ctx context.Context, b *bot.Bot, chatID int64, filename string, data []byte, caption string) error

SendBytes uploads an in-memory byte slice as a document.

Types

type ChownTo

type ChownTo struct {
	Uid, Gid uint32
}

ChownTo optionally re-owns a written file to (Uid,Gid). Nil = skip chown.

Jump to

Keyboard shortcuts

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