github.com/fumiama/NanoBot@v0.0.0-20231122134259-c22d8183efca/example/main.go (about)

     1  package main
     2  
     3  import (
     4  	_ "github.com/fumiama/NanoBot/example/echo"
     5  
     6  	nano "github.com/fumiama/NanoBot"
     7  	log "github.com/sirupsen/logrus"
     8  )
     9  
    10  func main() {
    11  	log.SetLevel(log.DebugLevel)
    12  	nano.OpenAPI = nano.SandboxAPI
    13  	nano.OnMessageFullMatch("help").SetBlock(true).
    14  		Handle(func(ctx *nano.Ctx) {
    15  			_, _ = ctx.SendPlainMessage(false, "echo string")
    16  		})
    17  	nano.Run(nil, &nano.Bot{
    18  		AppID:      "你的AppID",
    19  		Token:      "你的Token",
    20  		Secret:     "你的Secret, 可以不填 (QQ群Bot必须填写)",
    21  		Intents:    nano.IntentGuildPublic,
    22  		SuperUsers: []string{"用户ID1", "用户ID2"},
    23  	})
    24  }