Merge pull request #495 from mri-moe/master

添加设置项,使得可以切换飞书和Lark API地址
This commit is contained in:
StarHeart 2021-08-16 17:40:27 +08:00 committed by GitHub
commit 802c39da32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 2 deletions

View File

@ -40,5 +40,11 @@
"desc": "猜一猜游戏、新闻一览、英文每日一词一短语等等含一键启动及docker容器部署就绪", "desc": "猜一猜游戏、新闻一览、英文每日一词一短语等等含一键启动及docker容器部署就绪",
"author": "ffreemt", "author": "ffreemt",
"repo": "https://github.com/ffreemt/koyeb-nb2" "repo": "https://github.com/ffreemt/koyeb-nb2"
},
{
"name": "DicePP",
"desc": "TRPG骰娘, 带先攻, 查询等功能, 主要面向DND5E. 面对骰主推出的船新版本, 内置Windows/Linux详细部署指南以及方便的自定义骰娘方法, 从回复文本到查询资料库都可轻松配置~",
"author": "pear-studio",
"repo": "https://github.com/pear-studio/nonebot-dicepp"
} }
] ]

View File

@ -318,5 +318,45 @@
"desc": "通过FlightRadar24查询航班信息", "desc": "通过FlightRadar24查询航班信息",
"author": "IronWolf-K", "author": "IronWolf-K",
"repo": "https://github.com/IronWolf-K/nonebot_plugin_fr24" "repo": "https://github.com/IronWolf-K/nonebot_plugin_fr24"
},
{
"id": "nonebot_plugin_heweather",
"link": "nonebot-plugin-heweather",
"name": "和风天气",
"desc": "获取和风天气信息并转换为图片",
"author": "kexue-z",
"repo": "https://github.com/kexue-z/nonebot-plugin-heweather"
},
{
"id": "nonebot_plugin_autohelp",
"link": "nonebot-plugin-autohelp",
"name": "nonebot-plugin-autohelp",
"desc": "响应help/菜单/帮助(群消息或私信)并提供已载入插件的帮助信息如命令名aliases模块文档",
"author": "ffreemt",
"repo": "https://github.com/ffreemt/nonebot-plugin-autohelp"
},
{
"id": "gugua_bot",
"link": "gugua_bot",
"name": "孤寡机器人",
"desc": "让你的孤寡朋友露出阳光的笑容",
"author": "Sclock",
"repo": "https://github.com/Sclock/gugua"
},
{
"id": "bugu_bot",
"link": "bugu_bot",
"name": "布谷机器人",
"desc": "增进你和你单身朋友的友谊",
"author": "Sclock",
"repo": "https://github.com/Sclock/bugu_bot"
},
{
"id": "nonebot_plugin_flexperm",
"link": "nonebot-plugin-flexperm",
"name": "nonebot-plugin-flexperm",
"desc": "精细化的 NoneBot 权限管理插件",
"author": "rmuchan",
"repo": "https://github.com/rmuchan/nonebot-plugin-flexperm"
} }
] ]

View File

@ -31,6 +31,9 @@ sidebarDepth: 0
* `tenant_access_token` / `feishu_tenant_access_token`: 请求飞书 API 后返回的租户密钥 * `tenant_access_token` / `feishu_tenant_access_token`: 请求飞书 API 后返回的租户密钥
* `is_lark` / `feishu_is_lark`: 是否使用Lark飞书海外版默认为 false
# NoneBot.adapters.feishu.exception 模块 # NoneBot.adapters.feishu.exception 模块

View File

@ -136,7 +136,10 @@ class Bot(BaseBot):
@property @property
def api_root(self) -> str: def api_root(self) -> str:
return "https://open.feishu.cn/open-apis/" if self.feishu_config.is_lark:
return "https://open.larksuite.com/open-apis/"
else:
return "https://open.feishu.cn/open-apis/"
@classmethod @classmethod
def register(cls, driver: Driver, config: "Config"): def register(cls, driver: Driver, config: "Config"):

View File

@ -14,6 +14,8 @@ class Config(BaseModel):
- ``encrypt_key`` / ``feishu_encrypt_key``: 飞书开放平台后台事件订阅处设置的 Encrypt Key - ``encrypt_key`` / ``feishu_encrypt_key``: 飞书开放平台后台事件订阅处设置的 Encrypt Key
- ``verification_token`` / ``feishu_verification_token``: 飞书开放平台后台事件订阅处设置的 Verification Token - ``verification_token`` / ``feishu_verification_token``: 飞书开放平台后台事件订阅处设置的 Verification Token
- ``tenant_access_token`` / ``feishu_tenant_access_token``: 请求飞书 API 后返回的租户密钥 - ``tenant_access_token`` / ``feishu_tenant_access_token``: 请求飞书 API 后返回的租户密钥
- ``is_lark`` / ``feishu_is_lark``: 是否使用Lark飞书海外版默认为 false
""" """
app_id: Optional[str] = Field(default=None, alias="feishu_app_id") app_id: Optional[str] = Field(default=None, alias="feishu_app_id")
app_secret: Optional[str] = Field(default=None, alias="feishu_app_secret") app_secret: Optional[str] = Field(default=None, alias="feishu_app_secret")
@ -22,6 +24,7 @@ class Config(BaseModel):
alias="feishu_verification_token") alias="feishu_verification_token")
tenant_access_token: Optional[str] = Field( tenant_access_token: Optional[str] = Field(
default=None, alias="feishu_tenant_access_token") default=None, alias="feishu_tenant_access_token")
is_lark: Optional[str] = Field(default=False, alias="feishu_is_lark")
class Config: class Config:
extra = "ignore" extra = "ignore"