stub for slash commands

This commit is contained in:
Brad Rydzewski 2016-04-12 10:12:14 -07:00
parent 89f4f500f3
commit df7068ef32
2 changed files with 16 additions and 1 deletions

View file

@ -142,6 +142,12 @@ func Load(middleware ...gin.HandlerFunc) http.Handler {
stream.GET("/:owner/:name/:build/:number", web.GetStream)
}
slash := e.Group("/slash/slack")
{
slash.Use(session.MustUser())
slash.POST("/slash", web.Slack)
}
auth := e.Group("/authorize")
{
auth.GET("", web.GetLogin)
@ -172,7 +178,7 @@ func normalize(h http.Handler) http.Handler {
parts := strings.Split(r.URL.Path, "/")[1:]
switch parts[0] {
case "settings", "repos", "api", "login", "logout", "", "authorize", "hook", "static", "gitlab":
case "settings", "slash", "repos", "api", "login", "logout", "", "authorize", "hook", "static", "gitlab":
// no-op
default:

9
web/slack.go Normal file
View file

@ -0,0 +1,9 @@
package web
import "github.com/gin-gonic/gin"
// Slack is handler function that handles Slack slash commands.
func Slack(c *gin.Context) {
text := c.PostForm("text")
c.String(200, "received message %s", text)
}