Skip to content

Commit

Permalink
Added file support for webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
mymmrac committed Oct 2, 2021
1 parent 86cf473 commit 5017a36
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type SetWebhookParams struct {
// Certificate - Optional. Upload your public key certificate so that the root certificate in use can be
// checked. See our self-signed guide (https://core.telegram.org/bots/self-signed) for details.
// Please upload as File, sending a FileID or URL will not work.
Certificate *InputFile `json:"certificate,omitempty"` // TODO: Implement fileCompatible
Certificate *InputFile `json:"certificate,omitempty"`

// IPAddress - Optional. The fixed IP address which will be used to send webhook requests instead of the IP
// address resolved through DNS
Expand All @@ -93,6 +93,16 @@ type SetWebhookParams struct {
DropPendingUpdates bool `json:"drop_pending_updates,omitempty"`
}

func (s *SetWebhookParams) fileParameters() map[string]*os.File {
fp := make(map[string]*os.File)

if s.Certificate != nil {
fp["certificate"] = s.Certificate.File
}

return fp
}

// SetWebhook - Use this method to specify a URL and receive incoming updates via an outgoing webhook.
// Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing
// a JSON-serialized Update (https://core.telegram.org/bots/api#update). In case of an unsuccessful request, we
Expand Down

0 comments on commit 5017a36

Please sign in to comment.