]> git.giacomolli.uk - onechat/commit
Call the Telegram Bot API
authorAnderson A. Giacomolli <agiacomolli@gmail.com>
Sat, 7 Nov 2026 13:18:47 +0000 (10:18 -0300)
committerAnderson A. Giacomolli <agiacomolli@gmail.com>
Sat, 7 Nov 2026 13:18:47 +0000 (10:18 -0300)
commitd206de3a2e839ffbda9cbdb10a3ed93c4915fce3
tree72dea021b394fbcde3dd5dab1f201ab63015c31e
parentb2873a2a0bf8b0ba648aebac51759e5fed89a2e2
Call the Telegram Bot API

A small client of the Bot API, on the standard library only, waits for
new messages with getUpdates long polling, sends plain text with no
parse mode, and shows the typing action. It tells a failure that a later
try can fix, such as a network error, HTTP 429 with its wait, or a
server error, from one that it cannot.

The bot token is a part of each URL, and a net/http error holds the URL.
So no error of the client wraps a net/http error: it keeps only the text
of the cause, with the token removed. A test checks the error text of
each kind of failure for the token.

Issue: a143bd8
botapi.go [new file with mode: 0644]
botapi_test.go [new file with mode: 0644]