helper method to generate a link for a file

pull/33/head
Syfaro 10 years ago
parent 1bceea1ca5
commit 6b9324ca39
  1. 8
      types.go

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