refactor: migrate to gotd (wip)

This commit is contained in:
krau
2024-11-08 23:00:57 +08:00
parent 32bd391129
commit fbdfc04ad8
14 changed files with 465 additions and 387 deletions

View File

@@ -9,9 +9,7 @@ import (
var rootCmd = &cobra.Command{
Use: "saveany-bot",
Short: "saveany-bot",
Run: func(cmd *cobra.Command, args []string) {
Run()
},
Run: Run,
}
func Execute() {

View File

@@ -1,13 +1,22 @@
package cmd
import (
"os"
"os/signal"
"syscall"
"github.com/krau/SaveAny-Bot/bootstrap"
"github.com/krau/SaveAny-Bot/bot"
"github.com/krau/SaveAny-Bot/core"
"github.com/krau/SaveAny-Bot/logger"
"github.com/spf13/cobra"
)
func Run() {
func Run(_ *cobra.Command, _ []string) {
bootstrap.InitAll()
go core.Run()
bot.Run()
core.Run()
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
sig := <-quit
logger.L.Info(sig, "exit")
}