IMO, we shouldn't be introducing distinct EditText/EditMarkup
methods because it just doesn't make sense, you can do both in
one and EditCaption is a pretty odd case so we live it be.
- Callback structs has been moved to callbacks.go
- User / Chat and its methods -> chat.go
- Concept of Editable and Message Signature introduced
- No more types.go, it's been refactored into media.go + friends
This commit refactors lots of duplicated code from bot.go, so
instead of having N redundant SendX methods, now it's the
responsibility of all Sendable objects to implement Send(..)
instead. Impl in types_send.go, 150 LOC only!
This is a breaking change! Reducing memory usage from 1544 bytes
down to 504 bytes on 64-bit system. Considering Message is the
most used Telebot type, it's a pretty big deal.
Also, now we finally can test optional fields against nil!
Bot.Errors channel has been introduced. It can be used to
debug Telebot. It also fixes sendFile() which used to upload
with its own custom http.Client instead of http.DefaultClient.
These changes make it possible to set custom options when responding to
inline queries, as described on
https://core.telegram.org/bots/api#answerinlinequery.
It also includes all the (non-cached) inline result types as described
at https://core.telegram.org/bots/api#inlinequeryresult.
Some remarks:
* The internals of sendCommand have changed. It now expects a
JSON-serializable object. Instead of doing GET requests with
URL-encoded query parameters it now POSTS JSON directly.
* Because of the above, sendFile() has changed as well. It now expects a
* `map[string]string` which it will internally convert to URL encoded
form values.
* Respond has been deprecated in favor of the new AnswerInlineQuery
function. It is only kept for backward compatibility.
* A dependency on https://github.com/mitchellh/hashstructure has been
introduced in order to generate automatic IDs for inline results.
* Chage signature of "Destination()", because we need send username in "chat_id" when
sending message to channel.
* By telegram API document, chat id is "not exceeding 1e13 by absolute value" which
needs int64 to store it.