-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (30 loc) · 994 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"log"
"github.com/arjunmahishi/Chatops/commanders"
"github.com/arjunmahishi/Chatops/config"
"github.com/arjunmahishi/Chatops/messenger"
"github.com/arjunmahishi/Chatops/routes"
echo "github.com/labstack/echo"
"github.com/labstack/echo/middleware"
)
var sender = messenger.NewMessenger()
func main() {
err := commanders.SyncCommands(config.Config.CommandsPath)
if err != nil {
// sender.Send("spaces/AAAA8fjBKEQ", "<users/all> Chatops has Crashed: \n```"+err.Error()+"```")
log.Fatalf(err.Error())
}
e := echo.New()
e.HideBanner = true
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"*"},
AllowHeaders: []string{"*"},
}))
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
Format: "${time_rfc3339} method=${method} uri=${uri} status=${status}\n",
}))
e.POST("/", routes.Chatbot)
// sender.Send("spaces/AAAA8fjBKEQ", "Chatops restarted at "+time.Now().String())
e.Logger.Fatal(e.Start(":1323"))
}