helper method to generate a link for a file

bot-api-6.1
Syfaro 2015-09-19 10:53:32 -05:00
parent 1bceea1ca5
commit 6b9324ca39
1 changed files with 8 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package tgbotapi
import ( import (
"encoding/json" "encoding/json"
"fmt"
"time" "time"
) )
@ -178,6 +179,13 @@ type File struct {
FilePath string `json:"file_path"` 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. // ReplyKeyboardMarkup allows the Bot to set a custom keyboard.
type ReplyKeyboardMarkup struct { type ReplyKeyboardMarkup struct {
Keyboard [][]string `json:"keyboard"` Keyboard [][]string `json:"keyboard"`