From a7d64a9d7d0844a131ae51695548b60a22bf96f2 Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Tue, 28 Aug 2018 15:30:07 +0300 Subject: [PATCH 1/2] add user/bot name & photo for webhook --- v1/types.go | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/v1/types.go b/v1/types.go index eeb24fd..28fd3ba 100644 --- a/v1/types.go +++ b/v1/types.go @@ -138,13 +138,26 @@ type WebhookRequest struct { // WebhookData request data type WebhookData struct { - ExternalUserID string `json:"external_user_id"` - ExternalMessageID string `json:"external_message_id,omitempty"` - ExternalChatID string `json:"external_chat_id"` - ChannelID uint64 `json:"channel_id"` - Content string `json:"content"` - QuoteExternalID string `json:"quote_external_id,omitempty"` - QuoteContent string `json:"quote_content,omitempty"` + ExternalUserID string `json:"external_user_id"` + ExternalMessageID string `json:"external_message_id,omitempty"` + ExternalChatID string `json:"external_chat_id"` + ChannelID uint64 `json:"channel_id"` + Content string `json:"content"` + QuoteExternalID string `json:"quote_external_id,omitempty"` + QuoteContent string `json:"quote_content,omitempty"` + User *newMessageDataUser `json:"user,omitempty"` + Bot *newMessageDataBot `json:"bot,omitempty"` +} + +type newMessageDataUser struct { + FirstName string `json:"first_name"` + LastName string `json:"last_name"` + Avatar string `json:"avatar"` +} + +type newMessageDataBot struct { + Name string `json:"name"` + Avatar string `json:"avatar"` } // TransportRequestMeta request metadata From 349cf3561dcd0c1a0cfca16c0d9ebd7dd13658e8 Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Tue, 28 Aug 2018 16:44:11 +0300 Subject: [PATCH 2/2] export types --- v1/types.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/v1/types.go b/v1/types.go index 28fd3ba..b4a2131 100644 --- a/v1/types.go +++ b/v1/types.go @@ -138,24 +138,24 @@ type WebhookRequest struct { // WebhookData request data type WebhookData struct { - ExternalUserID string `json:"external_user_id"` - ExternalMessageID string `json:"external_message_id,omitempty"` - ExternalChatID string `json:"external_chat_id"` - ChannelID uint64 `json:"channel_id"` - Content string `json:"content"` - QuoteExternalID string `json:"quote_external_id,omitempty"` - QuoteContent string `json:"quote_content,omitempty"` - User *newMessageDataUser `json:"user,omitempty"` - Bot *newMessageDataBot `json:"bot,omitempty"` + ExternalUserID string `json:"external_user_id"` + ExternalMessageID string `json:"external_message_id,omitempty"` + ExternalChatID string `json:"external_chat_id"` + ChannelID uint64 `json:"channel_id"` + Content string `json:"content"` + QuoteExternalID string `json:"quote_external_id,omitempty"` + QuoteContent string `json:"quote_content,omitempty"` + User *MessageDataUser `json:"user,omitempty"` + Bot *MessageDataBot `json:"bot,omitempty"` } -type newMessageDataUser struct { +type MessageDataUser struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Avatar string `json:"avatar"` } -type newMessageDataBot struct { +type MessageDataBot struct { Name string `json:"name"` Avatar string `json:"avatar"` }