-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.go
More file actions
53 lines (43 loc) · 967 Bytes
/
main.go
File metadata and controls
53 lines (43 loc) · 967 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
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"log/slog"
"main/bot"
// "main/bot/jobs"
"main/bot/jobs"
"main/bot/spokes/dialogues"
"main/bot/spokes/evil"
"main/bot/spokes/games/hangman"
"main/bot/spokes/general"
"os"
"os/signal"
"github.com/bwmarrin/discordgo"
)
func main() {
b, err := bot.New()
if err != nil {
slog.Error("Error creating Discord session", "err", err)
}
// Register spokes to bot
if bot.Evil {
b.RegisterSpoke(evil.GetEvil())
} else {
b.RegisterSpoke(dialogues.GetDialogues())
jobs.StartJob(b.Session)
}
b.RegisterSpoke(general.GetPrefix())
b.RegisterSpoke(hangman.GetHangManSpoke())
b.Identify.Intents = discordgo.IntentsAllWithoutPrivileged
b.SyncSpokes()
err = b.Open()
if err != nil {
slog.Error("Error opening Discord session", "err", err)
}
defer func() {
slog.Info("Bot terminating")
b.Close()
}()
slog.Info("Bot running", "user", b.State.User)
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
<-c
}