Documentation
¶
Index ¶
- func Receive(ctx context.Context, b *bot.Bot, doc *models.Document, caption string, ...) (string, int64, error)
- func Send(ctx context.Context, b *bot.Bot, chatID int64, path string) (int64, error)
- func SendBytes(ctx context.Context, b *bot.Bot, chatID int64, filename string, data []byte, ...) error
- type ChownTo
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).