feat: initial whatsmeow bot with command handler and context helpers
Core framework (Handler, Command, Default muxer) in core/ package. Command self-registration via init() with blank imports in cmds/. Context helpers (send, reply, download, upload) in context/ package. Permission system with GROUP_ONLY / PRIVATE_ONLY checks. WhatsApp client configured as Safari with history sync disabled.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package misc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
hc "neo/context"
|
||||
"neo/core"
|
||||
)
|
||||
|
||||
func init() { core.Default.Register(Ping) }
|
||||
|
||||
var Ping = &core.Command{
|
||||
Name: "ping",
|
||||
Aliases: []string{"test", "tes", "p"},
|
||||
Category: "general",
|
||||
Description: "Check bot response time",
|
||||
Permissions: []core.Permission{core.PermissionGroupOnly},
|
||||
Run: func(ctx *hc.Ctx) {
|
||||
t := ctx.Event().Info.Timestamp
|
||||
speed := time.Since(t).Milliseconds()
|
||||
ctx.Reply(fmt.Sprintf("Pong! 🏓\n\nSpeed: %d ms", speed))
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user