all repos — telegram-bot-api @ d2539d0c5cea583d0971118189a5cb2f7590ca62

Golang bindings for the Telegram Bot API

Update more docs.
Syfaro syfaro@huefox.com
Fri, 20 Aug 2021 16:23:38 -0400
commit

d2539d0c5cea583d0971118189a5cb2f7590ca62

parent

9e20459100a7dbf269c7d018373a5e376dd272e6

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

jump to
M docs/internals/adding-endpoints.mddocs/internals/adding-endpoints.md

@@ -19,7 +19,8 @@ MessageID int

} ``` -What type should `ChatID` be? Telegram allows specifying numeric chat IDs or channel usernames. Golang doesn't have union types, and interfaces are entirely +What type should `ChatID` be? Telegram allows specifying numeric chat IDs or +channel usernames. Golang doesn't have union types, and interfaces are entirely untyped. This library solves this by adding two fields, a `ChatID` and a `ChannelUsername`. We can now write the struct as follows.

@@ -103,8 +104,8 @@ type DeleteMessageConfig struct {

ChannelUsername string ChatID int64 MessageID int -+ Delete interface{} -+ Thumb interface{} ++ Delete RequestFileData ++ Thumb RequestFileData } ```

@@ -115,13 +116,13 @@ ```go

func (config DeleteMessageConfig) files() []RequestFile { files := []RequestFile{{ Name: "delete", - File: config.Delete, + Data: config.Delete, }} if config.Thumb != nil { files = append(files, RequestFile{ Name: "thumb", - File: config.Thumb, + Data: config.Thumb, }) }

@@ -129,7 +130,8 @@ return files

} ``` -And now our files will upload! It will transparently handle uploads whether File is a string with a path to a file, `FileURL`, `FileBytes`, `FileReader`, or `FileID`. +And now our files will upload! It will transparently handle uploads whether File +is a `FilePath`, `FileURL`, `FileBytes`, `FileReader`, or `FileID`. ### Base Configs