Initial commit: web_hghl_server

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 16:28:14 +08:00
co-authored by Claude Opus 4.7
commit 65fca60622
653 changed files with 135901 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
package tgbot
import (
"testing"
)
func create(t *testing.T) *TgBot {
token := "1014745091:AAFkw5j3Fw4ytvWgIll6iRH1q5WooS6JO74"
robot := NewTelegramBot(token)
if err := robot.Init(); err != nil {
t.Error(err)
t.Fail()
}
// 注册命令.
cmds := BotCmdList{NewBotCmd("test", "return testfunc result", testfunc)}
robot.RegisterCommands(cmds)
return robot
}
func testfunc(string, int64) TgCmdRsp {
return TgCmdRsp{Buf: []byte("help"), BufType: TextType}
}
func TestReceive(t *testing.T) {
robot := create(t)
if err := robot.Receive(); err != nil {
t.Error(err)
t.Fail()
}
}
func TestSend(t *testing.T) {
robot := create(t)
robot.Send([]int64{790603940}, "test send")
}