feat: support lark app now (close #41)

This commit is contained in:
JustSong
2023-05-08 10:39:30 +08:00
parent 00a9f02974
commit 5b5a56122b
8 changed files with 297 additions and 42 deletions
+6
View File
@@ -9,6 +9,12 @@ export const CHANNEL_OPTIONS = [
},
{ key: 'corp', text: '企业微信群机器人', value: 'corp', color: '#019d82' },
{ key: 'lark', text: '飞书群机器人', value: 'lark', color: '#00d6b9' },
{
key: 'lark_app',
text: '飞书自建应用',
value: 'lark_app',
color: '#0d71fe',
},
{ key: 'ding', text: '钉钉群机器人', value: 'ding', color: '#007fff' },
{ key: 'bark', text: 'Bark App', value: 'bark', color: '#ff3b30' },
{
+72 -9
View File
@@ -20,7 +20,7 @@ const EditChannel = () => {
url: '',
other: '',
corp_id: '', // only for corp_app
agent_id: '' // only for corp_app
agent_id: '', // only for corp_app
};
const [inputs, setInputs] = useState(originInputs);
@@ -78,14 +78,16 @@ const EditChannel = () => {
localInputs.account_id += '|';
}
} else if (channels.length !== targets.length) {
showError('群组通道的子通道数量与目标数量不匹配,对于不需要指定的目标请直接留空');
showError(
'群组通道的子通道数量与目标数量不匹配,对于不需要指定的目标请直接留空'
);
return;
}
}
if (isEditing) {
res = await API.put(`/api/channel/`, {
...localInputs,
id: parseInt(channelId)
id: parseInt(channelId),
});
} else {
res = await API.post(`/api/channel`, localInputs);
@@ -258,9 +260,9 @@ const EditChannel = () => {
{
key: 'plugin',
text: '微信中的企业微信插件',
value: 'plugin'
value: 'plugin',
},
{ key: 'app', text: '企业微信 APP', value: 'app' }
{ key: 'app', text: '企业微信 APP', value: 'app' },
]}
value={inputs.other}
onChange={handleInputChange}
@@ -476,9 +478,11 @@ const EditChannel = () => {
return (
<>
<Message>
通过 OneBot 协议进行推送可以使用 <a href='https://github.com/Mrs4s/go-cqhttp'
target='_blank'>cqhttp</a>
利用 OneBot 协议可以实现推送 QQ 消息
通过 OneBot 协议进行推送可以使用{' '}
<a href='https://github.com/Mrs4s/go-cqhttp' target='_blank'>
cqhttp
</a>{' '}
等实现 利用 OneBot 协议可以实现推送 QQ 消息
</Message>
<Form.Group widths={3}>
<Form.Input
@@ -516,7 +520,8 @@ const EditChannel = () => {
对渠道进行分组然后在推送时选择分组进行推送可以实现一次性推送到多个渠道的功能
<br />
<br />
推送目标如若不填则使用子渠道的默认推送目标如果填写请务必全部按顺序填写对于不需要指定的直接留空即可例如 <code>123456789||@wechat</code>
推送目标如若不填则使用子渠道的默认推送目标如果填写请务必全部按顺序填写对于不需要指定的直接留空即可例如{' '}
<code>123456789||@wechat</code>
</Message>
<Form.Group widths={2}>
<Form.Input
@@ -538,6 +543,64 @@ const EditChannel = () => {
</Form.Group>
</>
);
case 'lark_app':
return (
<>
<Message>
通过飞书自建应用进行推送点击前往配置
<a target='_blank' href='https://open.feishu.cn/app'>
飞书开放平台
</a>
<br />
需要为应用添加机器人能力应用能力->添加应用能力>机器人
<br />
需要为应用添加消息发送权限开发配置->权限管理->权限配置->搜索获取与发送单聊群组消息->开通权限
<br />
注意添加完成权限后需要发布版本提交审核才能见效
<br />
注意推送目标的格式为
<strong>
<code>类型:ID</code>
</strong>
详见飞书
<a
href='https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create#bc6d1214'
target='_blank'
>
开发文档
</a>
中查询参数一节
</Message>
<Form.Group widths={3}>
<Form.Input
label='App ID'
name='app_id'
onChange={handleInputChange}
autoComplete='new-password'
value={inputs.app_id}
placeholder='应用凭证 -> App ID'
/>
<Form.Input
label='App Secret'
name='secret'
onChange={handleInputChange}
autoComplete='new-password'
value={inputs.secret}
placeholder='应用凭证 -> App Secret'
/>
<Form.Input
label='默认推送目标'
name='account_id'
onChange={handleInputChange}
autoComplete='new-password'
value={inputs.account_id}
placeholder='格式必须为:<类型>:<ID>,例如 open_id:123456'
/>
</Form.Group>
</>
);
case 'none':
return (
<>