all repos — telegram-bot-api @ 6b9324ca39aff0c94731af8df8f1f8fedb532260

Golang bindings for the Telegram Bot API

helper method to generate a link for a file
Syfaro syfaro@foxpaw.in
Sat, 19 Sep 2015 10:53:32 -0500
commit

6b9324ca39aff0c94731af8df8f1f8fedb532260

parent

1bceea1ca532fa0d7107a1ad08549f7d41d42b5c

1 files changed, 8 insertions(+), 0 deletions(-)

jump to
M types.gotypes.go

@@ -2,6 +2,7 @@ package tgbotapi

import ( "encoding/json" + "fmt" "time" )

@@ -176,6 +177,13 @@ type File struct {

FileID string `json:"file_id"` FileSize int `json:"file_size"` FilePath string `json:"file_path"` +} + +// Link returns a full path to the download URL for a File. +// +// It requires the Bot Token to create the link. +func (f *File) Link(token string) string { + return fmt.Sprintf(FileEndpoint, token, f.FilePath) } // ReplyKeyboardMarkup allows the Bot to set a custom keyboard.