stub for slash commands
This commit is contained in:
parent
89f4f500f3
commit
df7068ef32
2 changed files with 16 additions and 1 deletions
|
@ -142,6 +142,12 @@ func Load(middleware ...gin.HandlerFunc) http.Handler {
|
||||||
stream.GET("/:owner/:name/:build/:number", web.GetStream)
|
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 := e.Group("/authorize")
|
||||||
{
|
{
|
||||||
auth.GET("", web.GetLogin)
|
auth.GET("", web.GetLogin)
|
||||||
|
@ -172,7 +178,7 @@ func normalize(h http.Handler) http.Handler {
|
||||||
|
|
||||||
parts := strings.Split(r.URL.Path, "/")[1:]
|
parts := strings.Split(r.URL.Path, "/")[1:]
|
||||||
switch parts[0] {
|
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
|
// no-op
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
|
9
web/slack.go
Normal file
9
web/slack.go
Normal 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)
|
||||||
|
}
|
Loading…
Reference in a new issue