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.
25 lines
502 B
Go
25 lines
502 B
Go
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))
|
|
},
|
|
}
|