{"id":15034375,"url":"https://github.com/fumiama/nanobot","last_synced_at":"2025-04-10T00:21:08.438Z","repository":{"id":199412832,"uuid":"702773355","full_name":"fumiama/NanoBot","owner":"fumiama","description":"类ZeroBot的官方QQ频道/群聊全域机器人框架, 简单易用","archived":false,"fork":false,"pushed_at":"2023-11-22T13:43:01.000Z","size":186,"stargazers_count":55,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T02:04:58.827Z","etag":null,"topics":["golang","golang-api","golang-cli","golang-examples","golang-library","golang-package","qq","qq-bot","qq-group","qq-group-robot","qq-guild","qq-guild-bot","qq-login","qq-nt","qq-protocol","qq-robot","qqbot","qqrobot","zerobot","zerobot-plugin"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fumiama.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-10T01:45:55.000Z","updated_at":"2025-01-06T22:50:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"80744219-9e10-4db2-a76d-c2ea1e8b3ad3","html_url":"https://github.com/fumiama/NanoBot","commit_stats":null,"previous_names":["fumiama/nanobot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumiama%2FNanoBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumiama%2FNanoBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumiama%2FNanoBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumiama%2FNanoBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fumiama","download_url":"https://codeload.github.com/fumiama/NanoBot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248132081,"owners_count":21052972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","golang-api","golang-cli","golang-examples","golang-library","golang-package","qq","qq-bot","qq-group","qq-group-robot","qq-guild","qq-guild-bot","qq-login","qq-nt","qq-protocol","qq-robot","qqbot","qqrobot","zerobot","zerobot-plugin"],"created_at":"2024-09-24T20:24:47.348Z","updated_at":"2025-04-10T00:21:08.397Z","avatar_url":"https://github.com/fumiama.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\".github/nano.jpeg\" alt=\"东云名乃\" width = \"256\"\u003e\n  \u003cbr\u003e\n\n  \u003ch1\u003eNanoBot\u003c/h1\u003e\n  类ZeroBot的官方QQ频道/群聊全域机器人框架, 简单易用\u003cbr\u003e\u003cbr\u003e\n\n  \u003cimg src=\"https://counter.seku.su/cmoe?name=NanoBot\u0026theme=r34\" /\u003e\u003cbr\u003e\n\n\u003c/div\u003e\n\n## Instructions\n\n\u003e Note: This framework is built mainly for Chinese users thus may display hard-coded Chinese prompts during the interaction.\n\n参见 QQ 官方[文档](https://bot.q.qq.com/wiki/)。\n\n## 快速开始(基于插件)\n\u003e 查看`example`文件夹以获取更多信息\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd align=\"center\"\u003e\u003cimg src=\"https://github.com/fumiama/NanoBot/assets/41315874/6ef9fd95-ae99-449e-85e1-25797271e088\"\u003e\u003c/td\u003e\n\t\t\u003ctd align=\"center\"\u003e\u003cimg src=\"https://github.com/fumiama/NanoBot/assets/41315874/edd374e4-b8a5-4cff-a463-8c3b30e537c4\"\u003e\u003c/td\u003e\n        \u003ctd align=\"center\"\u003e\u003cimg src=\"https://github.com/fumiama/NanoBot/assets/41315874/ed1b063f-44b0-4950-ac35-1e72745cf3f4\"\u003e\u003c/td\u003e\n\t\u003c/tr\u003e\n    \u003ctr\u003e\n\t\t\u003ctd align=\"center\"\u003e开始响应\u003c/td\u003e\n\t\t\u003ctd align=\"center\"\u003e服务列表\u003c/td\u003e\n        \u003ctd align=\"center\"\u003e查看用法\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n![启用禁用](https://github.com/fumiama/NanoBot/assets/41315874/fc7f4774-f64b-44c5-9575-b9483bf3a455)\n\n\n```go\npackage main\n\nimport (\n\t_ \"github.com/fumiama/NanoBot/example/echo\"\n\n\tnano \"github.com/fumiama/NanoBot\"\n\tlog \"github.com/sirupsen/logrus\"\n)\n\nfunc main() {\n\tlog.SetLevel(log.DebugLevel)\n\tnano.OpenAPI = nano.SandboxAPI\n\tnano.OnMessageFullMatch(\"help\").SetBlock(true).\n\t\tHandle(func(ctx *nano.Ctx) {\n\t\t\t_, _ = ctx.SendPlainMessage(false, \"echo string\")\n\t\t})\n\tnano.Run(nil, \u0026nano.Bot{\n\t\tAppID:      \"你的AppID\",\n\t\tToken:      \"你的Token\",\n\t\tSecret:     \"你的Secret, 可以不填 (QQ群Bot必须填写)\",\n\t\tIntents:    nano.IntentPublic,\n\t\tSuperUsers: []string{\"用户ID1\", \"用户ID2\"},\n\t})\n}\n```\n\n## 更多选择(传统的事件驱动)\n\n\u003e 如果声明了 Handler, 所有插件将被禁用\n\n![event-based example](https://github.com/fumiama/NanoBot/assets/41315874/414ef9a6-1da2-49ff-b28e-9e3009cdb41c)\n\n```go\npackage main\n\nimport (\n\t\"strings\"\n\n\tnano \"github.com/fumiama/NanoBot\"\n\tlog \"github.com/sirupsen/logrus\"\n)\n\nfunc main() {\n\tlog.SetLevel(log.DebugLevel)\n\tnano.OpenAPI = nano.SandboxAPI\n\tnano.Run(nil, \u0026nano.Bot{\n\t\tAppID:   \"你的AppID\",\n\t\tToken:   \"你的Token\",\n\t\tSecret:  \"你的Secret, 可以不填 (QQ群Bot必须填写)\",\n\t\tIntents: nano.IntentPublic,\n\t\tHandler: \u0026nano.Handler{\n\t\t\tOnAtMessageCreate: func(s uint32, bot *nano.Bot, d *nano.Message) {\n\t\t\t\tu := \"\"\n\t\t\t\tif len(d.Attachments) \u003e 0 {\n\t\t\t\t\tu = d.Attachments[0].URL\n\t\t\t\t\tif !strings.HasPrefix(u, \"http\") {\n\t\t\t\t\t\tu = \"http://\" + u\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t_, err := bot.PostMessageToChannel(d.ChannelID, \u0026nano.MessagePost{\n\t\t\t\t\tContent:        \"您发送了: \" + d.Content,\n\t\t\t\t\tImage:          u,\n\t\t\t\t\tReplyMessageID: d.ID,\n\t\t\t\t\tMessageReference: \u0026nano.MessageReference{\n\t\t\t\t\t\tMessageID: d.ID,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tbot.PostMessageToChannel(d.ChannelID, \u0026nano.MessagePost{\n\t\t\t\t\t\tContent:        \"[ERROR]: \" + err.Error(),\n\t\t\t\t\t\tReplyMessageID: d.ID,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t})\n}\n```\n\n## Thanks\n\n- [ZeroBot](https://github.com/wdvxdr1123/ZeroBot)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumiama%2Fnanobot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffumiama%2Fnanobot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumiama%2Fnanobot/lists"}