feat: add 2048 minigame

This commit is contained in:
Fd
2026-09-03 18:02:36 +07:00
parent 1ef8fa3908
commit 6574a7fd17
6 changed files with 530 additions and 16 deletions
+29
View File
@@ -0,0 +1,29 @@
package minigame
import (
"fmt"
"os"
hc "neo/context"
"neo/core"
)
func init() { core.Default.Register(Game2048) }
var Game2048 = &core.Command{
Name: "2048",
Aliases: []string{"2048"},
Category: "minigame",
Description: "Play 2048 in WhatsApp",
Run: func(ctx *hc.Ctx) {
htmlBytes, err := os.ReadFile("cmds/minigame/2048.html")
if err != nil {
ctx.Reply(fmt.Sprintf("Failed to read HTML file: %v", err))
return
}
_, err = ctx.SendInteractiveHTML(string(htmlBytes))
if err != nil {
ctx.Reply(fmt.Sprintf("Failed to send game: %v", err))
}
},
}