(window.webpackJsonp=window.webpackJsonp||[]).push([[136],{608:function(t,s,v){"use strict";v.r(s);var a=v(21),_=Object(a.a)({},(function(){var t=this,s=t.$createElement,v=t._self._c||s;return v("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[v("h1",{attrs:{id:"飞书机器人使用指南"}},[v("a",{staticClass:"header-anchor",attrs:{href:"#飞书机器人使用指南"}},[t._v("#")]),t._v(" 飞书机器人使用指南")]),t._v(" "),v("p",[t._v("基于飞书开放平台事件回调与 API 进行机器人适配，目前仅适配企业自建应用。")]),t._v(" "),v("h2",{attrs:{id:"安装-nonebot-飞书-适配器"}},[v("a",{staticClass:"header-anchor",attrs:{href:"#安装-nonebot-飞书-适配器"}},[t._v("#")]),t._v(" 安装 NoneBot 飞书 适配器")]),t._v(" "),v("div",{staticClass:"language-bash line-numbers-mode"},[v("pre",{pre:!0,attrs:{class:"language-bash"}},[v("code",[t._v("pip "),v("span",{pre:!0,attrs:{class:"token function"}},[t._v("install")]),t._v(" nonebot-adapter-feishu\n")])]),t._v(" "),v("div",{staticClass:"line-numbers-wrapper"},[v("span",{staticClass:"line-number"},[t._v("1")]),v("br")])]),v("h2",{attrs:{id:"创建应用与启用应用-机器人-能力"}},[v("a",{staticClass:"header-anchor",attrs:{href:"#创建应用与启用应用-机器人-能力"}},[t._v("#")]),t._v(" 创建应用与启用应用“机器人”能力")]),t._v(" "),v("div",{staticClass:"custom-block tip"},[v("p",{staticClass:"custom-block-title"},[t._v("TIP")]),t._v(" "),v("p",[t._v("此部分可参考"),v("a",{attrs:{href:"https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app",target:"_blank",rel:"noopener noreferrer"}},[t._v("飞书开放平台-快速开发机器人-创建应用"),v("OutboundLink")],1),t._v("部分文档。")])]),t._v(" "),v("h2",{attrs:{id:"开启应用权限"}},[v("a",{staticClass:"header-anchor",attrs:{href:"#开启应用权限"}},[t._v("#")]),t._v(" 开启应用权限")]),t._v(" "),v("p",[t._v("应用拥有所需权限后，才能调用飞书接口获取相关信息。如果需要用到所有飞书平台的 API，请开启所有应用权限。")]),t._v(" "),v("p",[t._v("在仅群聊功能的情况下，需要为应用开启用户、消息、通讯录和群聊权限组所有权限。")]),t._v(" "),v("h2",{attrs:{id:"配置飞书事件订阅"}},[v("a",{staticClass:"header-anchor",attrs:{href:"#配置飞书事件订阅"}},[t._v("#")]),t._v(" 配置飞书事件订阅")]),t._v(" "),v("div",{staticClass:"custom-block tip"},[v("p",{staticClass:"custom-block-title"},[t._v("TIP")]),t._v(" "),v("p",[t._v("在添加事件订阅时请注意，带有**（历史版本）"),v("strong",[t._v("字样的事件的格式为")]),t._v("不受支持的旧版事件格式**，请使用对应的"),v("strong",[t._v("新版事件（不带历史版本字样）作为替代")]),t._v("。")])]),t._v(" "),v("p",[t._v("目前，飞书适配器支持以下事件：")]),t._v(" "),v("table",[v("thead",[v("tr",[v("th",[t._v("事件名称")]),t._v(" "),v("th",[t._v("事件描述")])])]),t._v(" "),v("tbody",[v("tr",[v("td",[t._v("接收消息")]),t._v(" "),v("td",[t._v("机器人接收到用户发送的消息。")])]),t._v(" "),v("tr",[v("td",[t._v("消息已读")]),t._v(" "),v("td",[t._v("用户阅读机器人发送的单聊消息。")])]),t._v(" "),v("tr",[v("td",[t._v("群解散")]),t._v(" "),v("td",[t._v("群组被解散。")])]),t._v(" "),v("tr",[v("td",[t._v("群配置更改")]),t._v(" "),v("td",[t._v("群组配置被修改后触发此事件，包含：群主转移、群基本信息修改、群权限修改。")])]),t._v(" "),v("tr",[v("td",[t._v("机器人进群")]),t._v(" "),v("td",[t._v("机器人被添加至群聊。")])]),t._v(" "),v("tr",[v("td",[t._v("机器人被移出群")]),t._v(" "),v("td",[t._v("机器人被移出群聊。")])]),t._v(" "),v("tr",[v("td",[t._v("用户进群")]),t._v(" "),v("td",[t._v("新用户进群。")])]),t._v(" "),v("tr",[v("td",[t._v("撤销拉用户进群")]),t._v(" "),v("td",[t._v("撤销拉用户进群。")])]),t._v(" "),v("tr",[v("td",[t._v("用户被移出群")]),t._v(" "),v("td",[t._v("用户主动退群或被移出群聊。")])])])]),t._v(" "),v("h2",{attrs:{id:"在-nonebot-配置中添加相应配置"}},[v("a",{staticClass:"header-anchor",attrs:{href:"#在-nonebot-配置中添加相应配置"}},[t._v("#")]),t._v(" 在 NoneBot 配置中添加相应配置")]),t._v(" "),v("p",[t._v("在 "),v("code",[t._v(".env")]),t._v(" 文件中添加以下部分")]),t._v(" "),v("div",{staticClass:"language- line-numbers-mode"},[v("pre",{pre:!0,attrs:{class:"language-text"}},[v("code",[t._v("APP_ID=<yourAppId>\nAPP_SECRET=<yourAppSecret>\nVERIFICATION_TOKEN=<yourVerificationToken>\n")])]),t._v(" "),v("div",{staticClass:"line-numbers-wrapper"},[v("span",{staticClass:"line-number"},[t._v("1")]),v("br"),v("span",{staticClass:"line-number"},[t._v("2")]),v("br"),v("span",{staticClass:"line-number"},[t._v("3")]),v("br")])]),v("p",[t._v("复制所创建应用**“凭证和基础信息”"),v("strong",[t._v("中的")]),t._v("App ID"),v("strong",[t._v("与")]),t._v("App Secret"),v("strong",[t._v("及")]),t._v("“事件订阅”"),v("strong",[t._v("中的")]),t._v("Verification Token**，替换上面相应的配置的值。")]),t._v(" "),v("p",[t._v("大功告成！现在可以试试向机器人发送消息进行测试了。")])])}),[],!1,null,null,null);s.default=_.exports}}]);