Open
Conversation
although already used when setting up webhooks, the parameters allowed_updates and max_connections were actually never passed to the api.
The certificate and privateKey are required values since they're used unconditionally when using webhooks. The url and host are optional but at least one of them has to be defined and using '0.0.0.0' as a default value for host would cause an invalid url to be autogenerated otherwise.
reply_markup actually only accepts JSON-serialized objects. For user convenience simply JSON.stringify() passed objects on demand.
This adds type declarations to the library making it fully typed for TypeScript support
The request data was actually serialized as multipart/form-data instead
of a JSON body. Passing JSON data with a boolean value then throw an
error while serializing:
bot.sendMessage({
chat_id: user.id,
text: text,
disable_web_page_preview: false, // throws an error
});
// > TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string or Buffer. Received type boolean
525cc20 to
b09a7e6
Compare
Contributor
Author
|
@mast: shamelessly pushing this PR again |
|
@mast Are you planning to add TypeScript support for this package? :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change set adds type declarations to allow using this package in TypeScript projects while having full support for autocompletion and integrated API documentation.
It also fixes some bugs I discovered along the way, mostly missing parameters/documentation in code comments.