Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

Commit

Permalink
add 在组织添加新仓库后会推送到订阅群
Browse files Browse the repository at this point in the history
  • Loading branch information
mcoo committed Jun 7, 2021
1 parent 6d3c524 commit 073676f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion githubManager/hookManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func NewManager(app *iris.Application, bot *OPQBot.BotManager) Manager {
ctx.StatusCode(404)
return
}
payload, err := h.WebHook.Parse((*ctx).Request(), github.PushEvent, github.PingEvent, github.ReleaseEvent, github.PullRequestEvent)
payload, err := h.WebHook.Parse((*ctx).Request(), github.RepositoryEvent, github.PushEvent, github.PingEvent, github.ReleaseEvent, github.PullRequestEvent)
if err != nil {
log.Println(err)
if err == github.ErrEventNotFound {
Expand All @@ -107,6 +107,15 @@ func NewManager(app *iris.Application, bot *OPQBot.BotManager) Manager {
switch v := payload.(type) {
case github.PingPayload:
log.Println(v)
case github.RepositoryPayload:
switch v.Action {
case "created":
r, _ := requests.Get(v.Sender.AvatarURL)
for _, v1 := range h.Groups {
m.b.SendGroupPicMsg(v1, fmt.Sprintf("%s在%s发布了新的仓库: %s\n欢迎Star哟", v.Sender.Login, v.Organization.Login, v.Repository.FullName), r.Content())
}
}

case github.PushPayload:
var commitString []string
for _, v1 := range v.Commits {
Expand Down

0 comments on commit 073676f

Please sign in to comment.