Revert "fix: 对齐 OneBot schema 与合并转发消息处理行为 (#1694)" (#1701)
Release NapCat / validate-version (push) Canceled after 0s
Release NapCat / Build-Framework (push) Canceled after 0s
Release NapCat / Build-Shell (push) Canceled after 0s
Release NapCat / Download-QNX64 (push) Canceled after 0s
Release NapCat / release-napcat (push) Canceled after 0s
Release NapCat / validate-version (push) Canceled after 0s
Release NapCat / Build-Framework (push) Canceled after 0s
Release NapCat / Build-Shell (push) Canceled after 0s
Release NapCat / Download-QNX64 (push) Canceled after 0s
Release NapCat / release-napcat (push) Canceled after 0s
This reverts commit deae7fd467.
This commit is contained in:
54 files changed
+195
-1078
No files matched your search
@@ -15,12 +15,6 @@ class SendGroupMsg extends SendMsgBase {
|
||||
protected override async check (payload: SendMsgPayload): Promise<BaseCheckResult> {
|
||||
delete payload.user_id;
|
||||
payload.message_type = 'group';
|
||||
if (!payload.group_id) {
|
||||
return {
|
||||
valid: false,
|
||||
message: '缺少参数 group_id',
|
||||
};
|
||||
}
|
||||
return super.check(payload);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ export default class SetGroupAddRequest extends OneBotAction<PayloadType, Return
|
||||
async _handle (payload: PayloadType): Promise<null> {
|
||||
const flag = payload.flag.toString();
|
||||
const approve = payload.approve?.toString() !== 'false';
|
||||
const count = payload.count!;
|
||||
const reason = payload.reason ?? ' ';
|
||||
const count = payload.count;
|
||||
const invite_notify = this.obContext.apis.MsgApi.notifyGroupInvite.get(flag);
|
||||
const { doubt, notify } = invite_notify
|
||||
? {
|
||||
@@ -46,12 +47,12 @@ export default class SetGroupAddRequest extends OneBotAction<PayloadType, Return
|
||||
doubt,
|
||||
notify,
|
||||
approve ? NTGroupRequestOperateTypes.KAGREE : NTGroupRequestOperateTypes.KREFUSE,
|
||||
payload.reason ?? undefined
|
||||
reason
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
private async findNotify (flag: string, count: number): Promise<{
|
||||
private async findNotify (flag: string, count: number = 100): Promise<{
|
||||
doubt: boolean,
|
||||
notify: GroupNotify | undefined;
|
||||
}> {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { GroupActionsExamples } from '../example/GroupActionsExamples';
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
user_id: Type.String({ description: '用户QQ' }),
|
||||
duration: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 0, description: '禁言时长(秒)' })),
|
||||
duration: Type.Union([Type.Number(), Type.String()], { default: 0, description: '禁言时长(秒)' }),
|
||||
});
|
||||
|
||||
type PayloadType = Static<typeof PayloadSchema>;
|
||||
@@ -33,7 +33,7 @@ export default class SetGroupBan extends OneBotAction<PayloadType, ReturnType> {
|
||||
if (member_role === 4) throw new Error('cannot ban owner');
|
||||
// 例如无管理员权限时 result为 120101005 errMsg为 'ERR_NOT_GROUP_ADMIN'
|
||||
const ret = await this.core.apis.GroupApi.banMember(payload.group_id.toString(),
|
||||
[{ uid, timeStamp: +payload.duration! }]);
|
||||
[{ uid, timeStamp: +payload.duration }]);
|
||||
if (ret.result !== 0) throw new Error(ret.errMsg);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -20,21 +20,13 @@ export default class SetGroupLeave extends OneBotAction<PayloadType, ReturnType>
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionSummary = '退出群组';
|
||||
override actionDescription = '退出指定群聊;群主可通过 is_dismiss=true 解散群聊';
|
||||
override actionDescription = '退出或解散指定群聊';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = GroupActionsExamples.SetGroupLeave.payload;
|
||||
override returnExample = GroupActionsExamples.SetGroupLeave.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<null> {
|
||||
const isDismiss = typeof payload.is_dismiss === 'string'
|
||||
? payload.is_dismiss === 'true'
|
||||
: !!payload.is_dismiss;
|
||||
|
||||
if (isDismiss) {
|
||||
await this.core.apis.GroupApi.destroyGroup(payload.group_id.toString());
|
||||
} else {
|
||||
await this.core.apis.GroupApi.quitGroup(payload.group_id.toString());
|
||||
}
|
||||
await this.core.apis.GroupApi.quitGroup(payload.group_id.toString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user