✏️ add switcher for lark

This commit is contained in:
mri-moe 2021-08-14 13:04:15 +08:00
parent c4e3309026
commit 18c6bea451
3 changed files with 9 additions and 0 deletions

View File

@ -31,6 +31,9 @@ sidebarDepth: 0
* `tenant_access_token` / `feishu_tenant_access_token`: 请求飞书 API 后返回的租户密钥
* `reigon` / `feishu_or_lark`: 设置后端使用飞书服务器还是Lark服务器
# NoneBot.adapters.feishu.exception 模块

View File

@ -136,6 +136,9 @@ class Bot(BaseBot):
@property
def api_root(self) -> str:
if self.feishu_config.region == "Lark" :
return "https://open.larksuite.com/open-apis/"
else:
return "https://open.feishu.cn/open-apis/"
@classmethod

View File

@ -14,6 +14,8 @@ class Config(BaseModel):
- ``encrypt_key`` / ``feishu_encrypt_key``: 飞书开放平台后台事件订阅处设置的 Encrypt Key
- ``verification_token`` / ``feishu_verification_token``: 飞书开放平台后台事件订阅处设置的 Verification Token
- ``tenant_access_token`` / ``feishu_tenant_access_token``: 请求飞书 API 后返回的租户密钥
- ``region`` / ``feishu_or_lark``: 选择飞书服务器还是Lark服务器,如留空则默认为飞书服务器
"""
app_id: Optional[str] = Field(default=None, alias="feishu_app_id")
app_secret: Optional[str] = Field(default=None, alias="feishu_app_secret")
@ -22,6 +24,7 @@ class Config(BaseModel):
alias="feishu_verification_token")
tenant_access_token: Optional[str] = Field(
default=None, alias="feishu_tenant_access_token")
region: Optional[str] = Field(default=None, alias="feishu_or_lark")
class Config:
extra = "ignore"