feat: init commit

This commit is contained in:
krau
2024-10-10 23:31:01 +08:00
commit 1cbcebc148
31 changed files with 1673 additions and 0 deletions

17
cmd/root.go Normal file
View File

@@ -0,0 +1,17 @@
package cmd
import (
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "saveany-bot",
Short: "saveany-bot",
Run: func(cmd *cobra.Command, args []string) {
Run()
},
}
func Execute() {
rootCmd.Execute()
}

13
cmd/run.go Normal file
View File

@@ -0,0 +1,13 @@
package cmd
import (
"github.com/krau/SaveAny-Bot/bootstrap"
"github.com/krau/SaveAny-Bot/bot"
"github.com/krau/SaveAny-Bot/core"
)
func Run() {
bootstrap.InitAll()
go core.Run()
bot.Run()
}

18
cmd/version.go Normal file
View File

@@ -0,0 +1,18 @@
package cmd
import (
"fmt"
"runtime"
"github.com/krau/SaveAny-Bot/common"
"github.com/spf13/cobra"
)
var VersionCmd = &cobra.Command{
Use: "version",
Aliases: []string{"v"},
Short: "Print the version number of saveany-bot",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("saveany-bot version: %s %s/%s\nBuildTime: %s, Commit: %s\n", common.Version, runtime.GOOS, runtime.GOARCH, common.BuildTime, common.GitCommit)
},
}