{"id":15509754,"url":"https://github.com/willin/tuling","last_synced_at":"2025-04-23T02:33:04.005Z","repository":{"id":57382150,"uuid":"60685079","full_name":"willin/tuling","owner":"willin","description":"图灵机器人SDK for Node.js","archived":false,"fork":false,"pushed_at":"2017-07-07T08:38:09.000Z","size":20,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T17:40:52.808Z","etag":null,"topics":["bot","sdk","tuling"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-08T09:15:52.000Z","updated_at":"2022-01-08T17:15:54.000Z","dependencies_parsed_at":"2022-09-13T11:31:03.655Z","dependency_job_id":null,"html_url":"https://github.com/willin/tuling","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Ftuling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Ftuling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Ftuling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Ftuling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willin","download_url":"https://codeload.github.com/willin/tuling/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250357878,"owners_count":21417372,"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":["bot","sdk","tuling"],"created_at":"2024-10-02T09:43:42.000Z","updated_at":"2025-04-23T02:33:03.986Z","avatar_url":"https://github.com/willin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 图灵机器人SDK\n\n[![npm](https://img.shields.io/npm/v/tuling.svg?style=plastic)](https://npmjs.org/package/tuling) [![npm](https://img.shields.io/npm/dm/tuling.svg?style=plastic)](https://npmjs.org/package/tuling)\n[![npm](https://img.shields.io/npm/dt/tuling.svg?style=plastic)](https://npmjs.org/package/tuling)\n\n## 安装\n\n```bash\nnpm install --save tuling\n```\n\n## 使用\n\nES7:\n\n```js\nconst TULING = require('tuling');\n\nconst tuling = new TULING({key: 'xxx'});\n\n(async() =\u003e {\n  const result = await tuling.send({\n    userid: 1,\n    info: '你好吗',\n    loc: '南京市'\n  });\n  console.log(result);\n})();\n```\n\nES5:\n\n```js\nvar TULING = require('tuling');\n\nvar tuling = new TULING({key: 'xxx'});\n\ntuling.send({\n  userid: 1,\n  info: '你好吗',\n  loc: '南京市'\n}).then(function(result) {\n  console.log(result);\n})\n```\n\n## 进阶\n\n微信语音识别接入简单示例：\n\n```js\nvar TULING = require('tuling');\nvar wechat = require('wechat');\nvar express = require('express');\n\n// 填入配置项\nvar config = {\n  token: 'xxxx',\n  appid: 'xxxx',\n  encodingAESKey: 'xxxx'\n};\nvar tuling = new TULING({key: 'xxxx'});\n\nvar app = express();\napp.use(express.query());\n\napp.use('/', wechat(config, function (req, res, next) {\n  var message = req.weixin;\n  console.log(message);\n  if(message.Event!==undefined \u0026\u0026 message.Event ==='subscribe'){\n    return res.reply('欢迎关注xxxx，目前正处于测试阶段。');\n  }\n  if(message.MsgType==='text' || message.MsgType==='voice'){\n    return tuling.send({\n      userid: message.FromUserName,\n      info: message.Content || message.Recognition\n    }).then(function(result){\n      switch (result.code) {\n        case 200000:\n          return res.reply('\u003ca href=\"'+result.url+'\"\u003e'+result.text+'\u003c/a\u003e');\n          break;\n        case 302000:\n          var html = result.text;\n          for(item of result.list){\n            if(item.article!==''){\n              html+= ',\u003ca href=\"'+item.detailurl+'\"\u003e'+item.article+'\u003c/a\u003e'\n            }\n          }\n\n          return res.reply(html);\n          break;\n        case 308000:\n            var html = result.text;\n            for(item of result.list){\n              html+=',\u003ca href=\"'+item.detailurl+'\"\u003e'+item.name+'\u003c/a\u003e'\n            }\n\n            return res.reply(html);\n            break;\n        default:\n         return res.reply(result.text);\n      }\n    });\n  }\n}));\n\napp.listen(8080);\n```\n\n## License\n\nMIT\n\n通过支付宝捐赠：\n\n![qr](https://cloud.githubusercontent.com/assets/1890238/15489630/fccbb9cc-2193-11e6-9fed-b93c59d6ef37.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillin%2Ftuling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillin%2Ftuling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillin%2Ftuling/lists"}