-
Notifications
You must be signed in to change notification settings - Fork 959
Deduplicate code, improve response accuracy. #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Handle error in NewWebhook and NewWebhookWithCert
Add helper for InlineKeyboardButtonLoginURL
Updates for Bot API 5.2, other small fixes
Add improved documentation
Updates for Bot API 5.3
Updates for Bot API 5.4
Create interface for file data
liyishuai
reviewed
Dec 24, 2021
Comment on lines
-467
to
-480
// SetWebhook sets a webhook. | ||
// | ||
// If this is set, GetUpdates will not get any data! | ||
// | ||
// If you do not have a legitimate TLS certificate, you need to include | ||
// your self signed certificate with the config. | ||
func (bot *BotAPI) SetWebhook(config WebhookConfig) (APIResponse, error) { | ||
|
||
if config.Certificate == nil { | ||
v := url.Values{} | ||
v.Add("url", config.URL.String()) | ||
if config.MaxConnections != 0 { | ||
v.Add("max_connections", strconv.Itoa(config.MaxConnections)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README example needs to be updated correspondingly:
Line 90 in 4fe428c
_, err = bot.SetWebhook(wh) |
Closed
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 PR internally restructures the library so that new configs only need a
params
method instead of requiring a duplicatedvalues
method. It also removes the number of unnecessary functions that return anAPIResponse
, which is a breaking change. This would be tagged v5.I'd love to get feedback on these changes, make sure I haven't overlooked anything obvious, and to hear if there's any other ideas for improving features that might result in backwards incompatible changes.
If you want to test this version, you can use go 1.11's mod tool to directly fetch the develop branch.
export GO111MODULES=on go get github.com/go-telegram-bot-api/telegram-bot-api@develop