Skip to content

Commit

Permalink
chore: custom channel per log
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Feb 6, 2019
1 parent c2f78d1 commit 7a18ab8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (s *Server) getVersion(arts []*circleci.Artifact, kind string) (string, err
return "", fmt.Errorf("no version found")
}

func (s *Server) sendUserActionToSlack(c echo.Context, action string, color string) {
func (s *Server) sendUserActionToSlack(c echo.Context, action string, color string, channel string) {
if s.NoSlack {
return
}
Expand Down Expand Up @@ -130,7 +130,7 @@ func (s *Server) sendUserActionToSlack(c echo.Context, action string, color stri
Text: fmt.Sprintf("%s (%s)", action, c.Path()),
//Username: "yolo",
Username: username,
Channel: "#yolologs",
Channel: channel,
IconEmoji: ":yolo:",
//IconUrl: profile["picture"].(string),
Attachments: []slack.Attachment{attachment},
Expand All @@ -143,11 +143,11 @@ func (s *Server) sendUserActionToSlack(c echo.Context, action string, color stri
}

func (s *Server) sendUserErrorToSlack(c echo.Context, err error) {
s.sendUserActionToSlack(c, fmt.Sprintf("error: %v", err), "#ff0000")
s.sendUserActionToSlack(c, fmt.Sprintf("error: %v", err), "#ff0000", "#yolodebug")
}

func (s *Server) GetIPA(c echo.Context) error {
s.sendUserActionToSlack(c, "IPA download", "#0000ff")
s.sendUserActionToSlack(c, "IPA download", "#0000ff", "#yolologs")
id := c.Param("*")
arts, err := s.client.GetArtifacts(id, true)
if err != nil {
Expand All @@ -172,7 +172,7 @@ func (s *Server) GetIPA(c echo.Context) error {
}

func (s *Server) GetAPK(c echo.Context) error {
s.sendUserActionToSlack(c, "Android download", "#00ff00")
s.sendUserActionToSlack(c, "Android download", "#00ff00", "#yolologs")
id := c.Param("*")
arts, err := s.client.GetArtifacts(id, true)
if err != nil {
Expand Down Expand Up @@ -343,7 +343,7 @@ type ReleasesDay struct {
}

func (s *Server) ListRelease(c echo.Context, job string) error {
s.sendUserActionToSlack(c, fmt.Sprintf("List Releases (%s)", job), "#00ffff")
s.sendUserActionToSlack(c, fmt.Sprintf("List Releases (%s)", job), "#00ffff", "#yolodebug")

data := map[string]interface{}{}

Expand Down Expand Up @@ -518,7 +518,7 @@ func (s *Server) ReleaseIOS(c echo.Context) error {
}

func (s *Server) Itms(c echo.Context) error {
s.sendUserActionToSlack(c, "ITMS download", "#0000ff")
s.sendUserActionToSlack(c, "ITMS download", "#0000ff", "#yolologs")

pull := c.Param("*")

Expand Down

0 comments on commit 7a18ab8

Please sign in to comment.