This commit gets rid of multiple redundant copies of MarhsalJSON()
method present for all existing IQR. It does so by introducing a
new struct called InlineQueryResultBase, which takes care of new
Type (for JSON) and existing duplicated ID field.
InlineQueryResults is a new helper wrapper for []IQR slices. It
implements MarshalJSON, which makes sure IQR.ID and IQR.Type are
set properly (by computing a hash and infering IQR type).
This would fix the problem that forwarded messages from channels don't get detected as forwarded and allows you to get the chat id of the channel the message was originally posted to.
This commit gets rid of multiple redundant copies of MarhsalJSON()
method present for all existing IQR. It does so by introducing a
new struct called InlineQueryResultBase, which takes care of new
Type (for JSON) and existing duplicated ID field.
InlineQueryResults is a new helper wrapper for []IQR slices. It
implements MarshalJSON, which makes sure IQR.ID and IQR.Type are
set properly (by computing a hash and infering IQR type).
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.