Browse Source

Update main.go

Drn 2 năm trước cách đây
mục cha
commit
8e46e846a8
1 tập tin đã thay đổi với 5 bổ sung6 xóa
  1. 5 6
      main.go

+ 5 - 6
main.go

@@ -123,7 +123,7 @@ func main() {
 		mainWg.Done()
 	}()
 
-	mainWg.Wait() // wait because api uses credentials from json
+	mainWg.Wait() // wait because credentials from json
 
 	mainWg.Add(2)
 	go botLoadAPIs()
@@ -600,6 +600,10 @@ func botLoadDiscord() {
 
 	// Discord Login
 	connectBot := func() {
+		// Event Handlers
+		botCommands = handleCommands()
+		bot.AddHandler(messageCreate)
+		bot.AddHandler(messageUpdate)
 		// Connect Bot
 		bot.LogLevel = -1 // to ignore dumb wsapi error
 		err = bot.Open()
@@ -708,11 +712,6 @@ do_discord_login:
 		selfbot = bot.State.User.Email != ""
 	}
 
-	// Event Handlers
-	botCommands = handleCommands()
-	bot.AddHandler(messageCreate)
-	bot.AddHandler(messageUpdate)
-
 	// Source Validation
 	if config.Debug {
 		log.Println(lg("Discord", "Validation", color.HiYellowString, "Validating configured sources..."))