{"id":27037126,"url":"https://github.com/isboyjc/wechaty-room-invite","last_synced_at":"2025-06-23T09:34:06.696Z","repository":{"id":65472306,"uuid":"272042839","full_name":"isboyjc/wechaty-room-invite","owner":"isboyjc","description":"Invite user to rooms by keyword","archived":false,"fork":false,"pushed_at":"2020-06-14T11:36:09.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T22:02:14.175Z","etag":null,"topics":["room-invite","wechaty","wechaty-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/isboyjc.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}},"created_at":"2020-06-13T16:11:47.000Z","updated_at":"2023-02-06T16:56:48.000Z","dependencies_parsed_at":"2023-01-25T01:45:23.148Z","dependency_job_id":null,"html_url":"https://github.com/isboyjc/wechaty-room-invite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/isboyjc/wechaty-room-invite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isboyjc%2Fwechaty-room-invite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isboyjc%2Fwechaty-room-invite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isboyjc%2Fwechaty-room-invite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isboyjc%2Fwechaty-room-invite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isboyjc","download_url":"https://codeload.github.com/isboyjc/wechaty-room-invite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isboyjc%2Fwechaty-room-invite/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261453150,"owners_count":23160455,"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":["room-invite","wechaty","wechaty-plugin"],"created_at":"2025-04-05T01:16:30.573Z","updated_at":"2025-06-23T09:34:01.673Z","avatar_url":"https://github.com/isboyjc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wechaty-room-invite\n\n[![Wechaty Plugin Contrib](https://img.shields.io/badge/Wechaty%20Plugin-wechaty--room--invite-brightgreen.svg)](https://github.com/isboyjc/wechaty-room-invite) [![Powered by Wechaty](https://img.shields.io/badge/Powered%20By-Wechaty-brightgreen.svg)](https://github.com/Wechaty/wechaty)\n\nInvite user to rooms by keyword\n\n通过关键字邀请用户进入房间\n\n## 开始\n\n### 简介\n\n你可以向机器人发送某些关键字，机器人会通过这些关键字邀请你进入对应的房间，当然，可以是多个房间\n\n### 安装\n\n```txt\nnpm install wechaty-room-invite\n\nor\n\nyarn add wechaty-room-invite\n```\n\n### 使用\n\n```js\nconst WechatyRoomInvite = require(\"wechaty-room-invite\")\n\nbot.use(WechatyRoomInvite(options))\n```\n\n如上所示\n\n使用插件只要按需传入配置对象 `options` 即可\n\n| Options 参数属性 | 类型          | 简介                                                                                                                                                                                                                                                                                                                                        |\n| ---------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| keyword          | String\\|Array | 触发邀请该用户的关键字，只有一个可以使用字符串类型，多个关键字使用数组类型                                                                                                                                                                                                                                                                  |\n| roomList         | Array         | 机器人管理的群聊列表，该项为必填项，数组对象中具体配置请看下面示例                                                                                                                                                                                                                                                                          |\n| reply            | String        | roomList 数组长度大于 1 时，视为管理多个群聊，那么 keyword 触发后会回复用户当前管理的群聊列表数据供用户选择进入某一个群，这个群聊数据列表为一段由 roomList 配置生成的话，roomList 数组长度等于 1 时，keyword 触发将会直接拉起群邀请，那么此字段也无用，reply 字段不是必选项，管理多个群聊时，建议直接使用默认文字，默认流程可看最后示例图片 |\n\n我们来看 `roomList` 数组的配置示例\n\n```js\nroomList: [\n  {\n    // 群聊名字，管理多个群聊时用户可通过群聊名字选择某个群聊\n    name: \"微信机器人\",\n    // 群聊id\n    roomId: \"22275855499@chatroom\",\n    // 群聊别名，建议简短，管理多个群聊时用户可通过别名选择某个群聊，叫它[编号]可能更好\n    alias: \"A05\",\n    // 标签，用于在管理多个群聊时给各个群聊做一个简单的标识，方便用户选择\n    label: \"新群\",\n    // 是否关闭进入，如果为true，则触发该群时，会提示该群不可进入\n    close: true,\n  },\n  ...\n]\n```\n\n### 示例\n\n```js\nconst { Wechaty } = require(\"wechaty\")\nconst { PuppetPadplus } = require(\"wechaty-puppet-padplus\")\nconst Qrterminal = require(\"qrcode-terminal\")\n// 插件 WechatyRoomInvite\nconst WechatyRoomInvite = require(\"wechaty-room-invite\")\n\n// 初始化 bot\nconst bot = new Wechaty({\n  puppet: new PuppetPadplus({\n    // 机器人padplus协议token\n    token: PUPPET_PADPLUS_TOKEN,\n  }),\n  // 机器人名字\n  name: ROBOT_NAME,\n})\n\n// 插件参数配置\nconst options = {\n  keyword: [\"加群\", \"入群\", \"群\"],\n  roomList: [\n    {\n      name: \"Web圈0x01\",\n      roomId: \"10614174865@chatroom\",\n      alias: \"A01\",\n      label: \"推荐\",\n    },\n    {\n      name: \"Web圈0x02\",\n      roomId: \"22825376327@chatroom\",\n      alias: \"A02\",\n      label: \"新群\",\n    },\n    {\n      name: \"微信机器人\",\n      roomId: \"24661539197@chatroom\",\n      alias: \"A04\",\n      label: \"推荐\",\n    },\n    {\n      name: \"男神开门群\",\n      roomId: \"22275855499@chatroom\",\n      alias: \"A05\",\n      label: \"测试\",\n      close: true,\n    },\n  ],\n  reply: \"\",\n}\n\n// 使用插件\nbot.use(WechatyRoomInvite(options))\n\nbot\n  .on(\"scan\", (qrcode, status) =\u003e {\n    Qrterminal.generate(qrcode, { small: true })\n  })\n  .start()\n```\n\n### 最后\n\n扫描二维码，加圈子微信，可进交流群哦，效果如下图，赶快来试试吧\n\n下图为多个群聊管理，只有 `roomList` 数组长度为 1 时，不会显示 `reply` ，将会直接拉起群邀请\n\n\u003cimg src=\"https://gitee.com/IsboyJC/PictureBed/raw/master/other/asdakshdajshdas1.jpeg\" width=\"200\" height=\"200\" alt=\"图片名称\" align=left /\u003e\n\n\u003cdiv style=\"left\"\u003e\n\u003cimg src=\"https://gitee.com/IsboyJC/PictureBed/raw/master/other/image-20200614182527276.png\" width=\"200\" height=\"420\"  alt=\"图片名称\" align=left /\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisboyjc%2Fwechaty-room-invite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisboyjc%2Fwechaty-room-invite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisboyjc%2Fwechaty-room-invite/lists"}