fix(api): fix guild.approve

This commit is contained in:
Il Harper 2024-10-05 13:55:08 +08:00
parent e5b907d155
commit d09ac0e040
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC
2 changed files with 9 additions and 11 deletions

View File

@ -6,27 +6,25 @@ export const buildGuildApprove =
async ({ message_id, approve, comment }: ApprovePayload) => {
if (comment)
ctx.chronocat.l.warn(
'不支持处理群请时附加备注消息。备注消息将会被忽略。',
'不支持处理群请时附加备注消息。备注消息将会被忽略。',
{
code: 2144,
},
)
// TODO: 看下是否是真的不支持
if (!approve) {
ctx.chronocat.l.error('暂不支持拒绝群邀请。', { code: 2145 })
throw new Error('暂不支持拒绝群邀请。')
}
const [seq, groupCode] = message_id.split(':')
if (!seq || !groupCode)
ctx.chronocat.l.warn('message_id 不合法。将仍然尝试处理加群请求。')
// 这个是同意发过来的小卡片
await operateSysNotify({
doubt: false,
operateMsg: {
operateType: 1,
operateType: approve ? 1 : 2,
targetMsg: {
seq: '',
seq: seq!,
type: 1,
groupCode: message_id,
groupCode: groupCode!,
postscript: '',
},
},

View File

@ -82,7 +82,7 @@ export class GuildRequestDispatchMessage implements SatoriDispatchMessage {
member: {},
message: {
id: '',
id: `${this.notify.seq}:${this.notify.group.groupCode}`,
content: this.notify.postscript,
},
}