@@ -148,6 +148,25 @@ func getTelegramPullRequestPayload(p *api.PullRequestPayload) (*TelegramPayload,
148148 }, nil
149149}
150150
151+ func getTelegramPullRequestApprovalPayload (p * api.PullRequestPayload , event models.HookEventType ) (* TelegramPayload , error ) {
152+ var text , attachmentText string
153+ switch p .Action {
154+ case api .HookIssueSynchronized :
155+ action , err := parseHookPullRequestEventType (event )
156+ if err != nil {
157+ return nil , err
158+ }
159+
160+ text = fmt .Sprintf ("[%s] Pull request review %s: #%d %s" , p .Repository .FullName , action , p .Index , p .PullRequest .Title )
161+ attachmentText = p .Review .Content
162+
163+ }
164+
165+ return & TelegramPayload {
166+ Message : text + "\n " + attachmentText ,
167+ }, nil
168+ }
169+
151170func getTelegramRepositoryPayload (p * api.RepositoryPayload ) (* TelegramPayload , error ) {
152171 var title string
153172 switch p .Action {
@@ -192,6 +211,8 @@ func GetTelegramPayload(p api.Payloader, event models.HookEventType, meta string
192211 return getTelegramPushPayload (p .(* api.PushPayload ))
193212 case models .HookEventPullRequest :
194213 return getTelegramPullRequestPayload (p .(* api.PullRequestPayload ))
214+ case models .HookEventPullRequestRejected , models .HookEventPullRequestApproved , models .HookEventPullRequestComment :
215+ return getTelegramPullRequestApprovalPayload (p .(* api.PullRequestPayload ), event )
195216 case models .HookEventRepository :
196217 return getTelegramRepositoryPayload (p .(* api.RepositoryPayload ))
197218 case models .HookEventRelease :
0 commit comments