-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
46 lines (36 loc) · 1.08 KB
/
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
40
41
42
43
44
45
46
package main
import (
event2 "github.com/Goscord/goscord/goscord/gateway/event"
"os"
"github.com/Goscord/goscord/goscord"
"github.com/Goscord/goscord/goscord/gateway"
"github.com/joho/godotenv"
"github.com/Goscord/Bot/command"
"github.com/Goscord/Bot/event"
)
var (
client *gateway.Session
cmdMgr *command.CommandManager
)
func main() {
// Load envionment variables :
_ = godotenv.Load()
// Create client instance :
client = goscord.New(&gateway.Options{
Token: os.Getenv("BOT_TOKEN"),
Intents: gateway.IntentGuilds | gateway.IntentGuildMessages | gateway.IntentGuildMembers | gateway.IntentGuildVoiceStates,
})
// Load command manager :
cmdMgr = command.NewCommandManager(client)
// Load events :
_ = client.On(event2.EventReady, event.OnReady(client, cmdMgr))
_ = client.On(event2.EventInteractionCreate, cmdMgr.Handler(client))
_ = client.On(event2.EventGuildMemberAdd, event.OnGuildMemberAdd(client))
// TODO: Check player status with voiceStateUpdate event
// Login client :
if err := client.Login(); err != nil {
panic(err)
}
// Keep bot running :
select {}
}