-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (31 loc) · 892 Bytes
/
main.go
File metadata and controls
41 lines (31 loc) · 892 Bytes
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
40
41
package main
import (
"log"
"net/http"
"os"
tempest "github.com/amatsagu/tempest"
"github.com/dhrdlicka/errorbot/commands"
)
func main() {
err := commands.LoadRepo()
if err != nil {
log.Fatal(err)
}
client := tempest.NewHTTPClient(tempest.HTTPClientOptions{
PublicKey: os.Getenv("DISCORD_PUBLIC_KEY"),
BaseClientOptions: tempest.BaseClientOptions{
Token: os.Getenv("DISCORD_BOT_TOKEN"),
},
})
//client.RegisterCommand(commands.HelloCommand)
client.RegisterCommand(commands.ErrorCommand)
client.RegisterCommand(commands.BugCheckCommand)
client.RegisterCommand(commands.NTStatusCommand)
client.RegisterCommand(commands.HResultCommand)
err = client.SyncCommandsWithDiscord(nil, nil, false)
if err != nil {
log.Fatal(err)
}
http.HandleFunc("POST /interactions", client.DiscordRequestHandler)
log.Fatal(http.ListenAndServe(":"+os.Getenv("PORT"), nil))
}