mirror of
https://github.com/fumiama/NanoBot.git
synced 2026-06-06 03:00:24 +08:00
finish
This commit is contained in:
20
example/echo/main.go
Normal file
20
example/echo/main.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package echo
|
||||
|
||||
import (
|
||||
ctrl "github.com/FloatTech/zbpctrl"
|
||||
nano "github.com/fumiama/NanoBot"
|
||||
)
|
||||
|
||||
func init() {
|
||||
nano.Register("echo", &ctrl.Options[*nano.Ctx]{
|
||||
DisableOnDefault: false,
|
||||
Help: "- echo xxx",
|
||||
}).OnMessagePrefix("echo").SetBlock(true).
|
||||
Handle(func(ctx *nano.Ctx) {
|
||||
args := ctx.State["args"].(string)
|
||||
if args == "" {
|
||||
return
|
||||
}
|
||||
_, _ = ctx.SendPlainMessage(false, args)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user