-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
46 lines (35 loc) · 926 Bytes
/
main.go
File metadata and controls
46 lines (35 loc) · 926 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
package main
import (
"fmt"
"log"
"os"
"os/signal"
"syscall"
"github.com/bwmarrin/discordgo"
"github.com/joho/godotenv"
)
func main() {
godotenv.Load()
BOT_TOKEN := os.Getenv("BOT_TOKEN")
sess, err := discordgo.New("Bot " + BOT_TOKEN)
if err != nil {
log.Fatal(err)
}
// Handlers
sess.AddHandler(onGuildCreate)
sess.AddHandler(LeaveEveryServer)
//Intents
sess.Identify.Intents = discordgo.IntentsAllWithoutPrivileged
//Authorization
err = sess.Open()
//Set Status
sess.UpdateStreamingStatus(0, "Excalibur / Blood Group", "https://www.twitch.tv/404")
if err != nil {
log.Fatal(err)
}
defer sess.Close()
fmt.Println("The bot is online!\n\n[/] TOKEN: " + BOT_TOKEN + "\n[/] LINK: https://discord.com/api/oauth2/authorize?client_id=" + sess.State.User.ID + "&permissions=8&scope=bot")
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
<-sc
}