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
@@ -11,12 +11,12 @@ import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
const PayloadSchema = Type.Object({
|
||||
user_id: Type.String({ description: '用户QQ' }),
|
||||
message_seq: Type.Optional(Type.String({ description: '起始消息序号' })),
|
||||
count: Type.Optional(Type.Number({ default: 20, description: '获取消息数量' })),
|
||||
reverse_order: Type.Optional(Type.Boolean({ default: false, description: '是否反向排序' })),
|
||||
disable_get_url: Type.Optional(Type.Boolean({ default: false, description: '是否禁用获取URL' })),
|
||||
parse_mult_msg: Type.Optional(Type.Boolean({ default: true, description: '是否解析合并消息' })),
|
||||
quick_reply: Type.Optional(Type.Boolean({ default: false, description: '是否快速回复' })),
|
||||
reverseOrder: Type.Optional(Type.Boolean({ default: false, description: '是否反向排序(旧版本兼容)' })),
|
||||
count: Type.Number({ default: 20, description: '获取消息数量' }),
|
||||
reverse_order: Type.Boolean({ default: false, description: '是否反向排序' }),
|
||||
disable_get_url: Type.Boolean({ default: false, description: '是否禁用获取URL' }),
|
||||
parse_mult_msg: Type.Boolean({ default: true, description: '是否解析合并消息' }),
|
||||
quick_reply: Type.Boolean({ default: false, description: '是否快速回复' }),
|
||||
reverseOrder: Type.Boolean({ default: false, description: '是否反向排序(旧版本兼容)' }),
|
||||
});
|
||||
|
||||
type PayloadType = Static<typeof PayloadSchema>;
|
||||
@@ -39,10 +39,6 @@ export default class GetFriendMsgHistory extends OneBotAction<PayloadType, Retur
|
||||
|
||||
async _handle (payload: PayloadType, _adapter: string, config: NetworkAdapterConfig): Promise<ReturnType> {
|
||||
// 处理参数
|
||||
const count = payload.count!;
|
||||
const reverseOrder = payload.reverse_order! || payload.reverseOrder!;
|
||||
const parseMultMsg = payload.parse_mult_msg!;
|
||||
const disableGetUrl = payload.disable_get_url!;
|
||||
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
||||
if (!uid) throw new Error(`记录${payload.user_id}不存在`);
|
||||
const friend = await this.core.apis.FriendApi.isBuddy(uid);
|
||||
@@ -50,8 +46,8 @@ export default class GetFriendMsgHistory extends OneBotAction<PayloadType, Retur
|
||||
const hasMessageSeq = !payload.message_seq ? !!payload.message_seq : !(payload.message_seq?.toString() === '' || payload.message_seq?.toString() === '0');
|
||||
const startMsgId = hasMessageSeq ? (MessageUnique.getMsgIdAndPeerByShortId(+payload.message_seq!)?.MsgId ?? payload.message_seq!.toString()) : '0';
|
||||
const msgList = hasMessageSeq
|
||||
? (await this.core.apis.MsgApi.getMsgHistory(peer, startMsgId, +count, reverseOrder)).msgList
|
||||
: (await this.core.apis.MsgApi.getAioFirstViewLatestMsgs(peer, +count)).msgList;
|
||||
? (await this.core.apis.MsgApi.getMsgHistory(peer, startMsgId, +payload.count, payload.reverse_order || payload.reverseOrder)).msgList
|
||||
: (await this.core.apis.MsgApi.getAioFirstViewLatestMsgs(peer, +payload.count)).msgList;
|
||||
if (msgList.length === 0) throw new Error(`消息${payload.message_seq}不存在`);
|
||||
// 转换序号
|
||||
await Promise.all(msgList.map(async msg => {
|
||||
@@ -59,7 +55,7 @@ export default class GetFriendMsgHistory extends OneBotAction<PayloadType, Retur
|
||||
}));
|
||||
// 烘焙消息
|
||||
const ob11MsgList = (await Promise.all(
|
||||
msgList.map(msg => this.obContext.apis.MsgApi.parseMessage(msg, config.messagePostFormat, parseMultMsg, disableGetUrl)))
|
||||
msgList.map(msg => this.obContext.apis.MsgApi.parseMessage(msg, config.messagePostFormat, payload.parse_mult_msg, payload.disable_get_url)))
|
||||
).filter((msg): msg is OB11Message => msg !== undefined);
|
||||
return { messages: ob11MsgList };
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
folder_id: Type.Optional(Type.String({ description: '文件夹ID' })),
|
||||
folder: Type.Optional(Type.String({ description: '文件夹ID' })),
|
||||
file_count: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 50, description: '文件数量' })),
|
||||
file_count: Type.Union([Type.Number(), Type.String()], { default: 50, description: '文件数量' }),
|
||||
});
|
||||
|
||||
type PayloadType = Static<typeof PayloadSchema>;
|
||||
@@ -33,7 +33,7 @@ export class GetGroupFilesByFolder extends OneBotAction<PayloadType, ReturnType>
|
||||
async _handle (payload: PayloadType): Promise<ReturnType> {
|
||||
const retRaw = await this.core.apis.MsgApi.getGroupFileList(payload.group_id.toString(), {
|
||||
sortType: 1,
|
||||
fileCount: +payload.file_count!,
|
||||
fileCount: +payload.file_count,
|
||||
startIndex: 0,
|
||||
sortOrder: 2,
|
||||
showOnlinedocFolder: 0,
|
||||
|
||||
@@ -10,12 +10,12 @@ import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
message_seq: Type.Optional(Type.String({ description: '起始消息序号' })),
|
||||
count: Type.Optional(Type.Number({ default: 20, description: '获取消息数量' })),
|
||||
reverse_order: Type.Optional(Type.Boolean({ default: false, description: '是否反向排序' })),
|
||||
disable_get_url: Type.Optional(Type.Boolean({ default: false, description: '是否禁用获取URL' })),
|
||||
parse_mult_msg: Type.Optional(Type.Boolean({ default: true, description: '是否解析合并消息' })),
|
||||
quick_reply: Type.Optional(Type.Boolean({ default: false, description: '是否快速回复' })),
|
||||
reverseOrder: Type.Optional(Type.Boolean({ default: false, description: '是否反向排序(旧版本兼容)' })),
|
||||
count: Type.Number({ default: 20, description: '获取消息数量' }),
|
||||
reverse_order: Type.Boolean({ default: false, description: '是否反向排序' }),
|
||||
disable_get_url: Type.Boolean({ default: false, description: '是否禁用获取URL' }),
|
||||
parse_mult_msg: Type.Boolean({ default: true, description: '是否解析合并消息' }),
|
||||
quick_reply: Type.Boolean({ default: false, description: '是否快速回复' }),
|
||||
reverseOrder: Type.Boolean({ default: false, description: '是否反向排序(旧版本兼容)' }),
|
||||
});
|
||||
|
||||
type PayloadType = Static<typeof PayloadSchema>;
|
||||
@@ -37,18 +37,13 @@ export default class GoCQHTTPGetGroupMsgHistory extends OneBotAction<PayloadType
|
||||
override returnExample = GoCQHTTPActionsExamples.GetGroupMsgHistory.response;
|
||||
|
||||
async _handle (payload: PayloadType, _adapter: string, config: NetworkAdapterConfig): Promise<ReturnType> {
|
||||
const count = payload.count!;
|
||||
const reverseOrder = payload.reverse_order! || payload.reverseOrder!;
|
||||
const parseMultMsg = payload.parse_mult_msg!;
|
||||
const disableGetUrl = payload.disable_get_url!;
|
||||
const quickReply = payload.quick_reply!;
|
||||
const peer: Peer = { chatType: ChatType.KCHATTYPEGROUP, peerUid: payload.group_id.toString() };
|
||||
const hasMessageSeq = !payload.message_seq ? !!payload.message_seq : !(payload.message_seq?.toString() === '' || payload.message_seq?.toString() === '0');
|
||||
// 拉取消息
|
||||
const startMsgId = hasMessageSeq ? (MessageUnique.getMsgIdAndPeerByShortId(+payload.message_seq!)?.MsgId ?? payload.message_seq!.toString()) : '0';
|
||||
const msgList = hasMessageSeq
|
||||
? (await this.core.apis.MsgApi.getMsgHistory(peer, startMsgId, +count, reverseOrder)).msgList
|
||||
: (await this.core.apis.MsgApi.getAioFirstViewLatestMsgs(peer, +count)).msgList;
|
||||
? (await this.core.apis.MsgApi.getMsgHistory(peer, startMsgId, +payload.count, payload.reverse_order || payload.reverseOrder)).msgList
|
||||
: (await this.core.apis.MsgApi.getAioFirstViewLatestMsgs(peer, +payload.count)).msgList;
|
||||
if (msgList.length === 0) throw new Error(`消息${payload.message_seq}不存在`);
|
||||
// 转换序号
|
||||
await Promise.all(msgList.map(async msg => {
|
||||
@@ -56,7 +51,7 @@ export default class GoCQHTTPGetGroupMsgHistory extends OneBotAction<PayloadType
|
||||
}));
|
||||
// 烘焙消息
|
||||
const ob11MsgList = (await Promise.all(
|
||||
msgList.map(msg => this.obContext.apis.MsgApi.parseMessage(msg, config.messagePostFormat, parseMultMsg, disableGetUrl, quickReply)))
|
||||
msgList.map(msg => this.obContext.apis.MsgApi.parseMessage(msg, config.messagePostFormat, payload.parse_mult_msg, payload.disable_get_url, payload.quick_reply)))
|
||||
).filter((msg): msg is OB11Message => msg !== undefined);
|
||||
return { messages: ob11MsgList };
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
file_count: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 50, description: '文件数量' })),
|
||||
file_count: Type.Union([Type.Number(), Type.String()], { default: 50, description: '文件数量' }),
|
||||
});
|
||||
|
||||
type PayloadType = Static<typeof PayloadSchema>;
|
||||
@@ -31,7 +31,7 @@ export class GetGroupRootFiles extends OneBotAction<PayloadType, ReturnType> {
|
||||
async _handle (payload: PayloadType) {
|
||||
const ret = await this.core.apis.MsgApi.getGroupFileList(payload.group_id.toString(), {
|
||||
sortType: 1,
|
||||
fileCount: +payload.file_count!,
|
||||
fileCount: +payload.file_count,
|
||||
startIndex: 0,
|
||||
sortOrder: 2,
|
||||
showOnlinedocFolder: 0,
|
||||
|
||||
@@ -17,14 +17,16 @@ export class GetOnlineClient extends OneBotAction<PayloadType, ReturnType> {
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionSummary = '获取在线客户端';
|
||||
override actionDescription = '获取当前登录账号的在线客户端列表;当前兼容实现返回空列表';
|
||||
override actionDescription = '获取当前登录账号的在线客户端列表';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GetOnlineClient.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GetOnlineClient.response;
|
||||
|
||||
async _handle (): Promise<ReturnType> {
|
||||
async _handle () {
|
||||
// 注册监听
|
||||
this.core.apis.SystemApi.getOnlineDev();
|
||||
await sleep(500);
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
user_id: Type.String({ description: '用户QQ' }),
|
||||
no_cache: Type.Optional(Type.Union([Type.Boolean(), Type.String()], { default: false, description: '是否不使用缓存' })),
|
||||
no_cache: Type.Union([Type.Boolean(), Type.String()], { default: false, description: '是否不使用缓存' }),
|
||||
});
|
||||
|
||||
type PayloadType = Static<typeof PayloadSchema>;
|
||||
|
||||
@@ -20,12 +20,12 @@ export class GoCQHTTPCheckUrlSafely extends OneBotAction<GoCQHTTPCheckUrlSafelyP
|
||||
override payloadSchema = GoCQHTTPCheckUrlSafelyPayloadSchema;
|
||||
override returnSchema = GoCQHTTPCheckUrlSafelyReturnSchema;
|
||||
override actionSummary = '检查URL安全性';
|
||||
override actionDescription = '检查指定URL的安全等级;当前兼容实现固定返回安全等级 1';
|
||||
override actionDescription = '检查指定URL的安全等级';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GoCQHTTPCheckUrlSafely.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GoCQHTTPCheckUrlSafely.response;
|
||||
|
||||
async _handle (): Promise<GoCQHTTPCheckUrlSafelyReturn> {
|
||||
async _handle () {
|
||||
return { level: 1 };
|
||||
}
|
||||
}
|
||||
@@ -26,12 +26,7 @@ export class GoCQHTTPGetModelShow extends OneBotAction<GoCQHTTPGetModelShowPaylo
|
||||
override actionDescription = '获取当前账号可用的设备机型显示名称列表';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GoCQHTTPGetModelShow.payload;
|
||||
override returnExample = [{
|
||||
variants: {
|
||||
model_show: 'napcat',
|
||||
need_pay: false,
|
||||
},
|
||||
}];
|
||||
override returnExample = GoCQHTTPActionsExamples.GoCQHTTPGetModelShow.response;
|
||||
|
||||
async _handle (payload: GoCQHTTPGetModelShowPayload) {
|
||||
if (!payload.model) {
|
||||
|
||||
@@ -1,27 +1,20 @@
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
const PayloadSchema = Type.Object({});
|
||||
|
||||
type PayloadType = Static<typeof PayloadSchema>;
|
||||
|
||||
const ReturnSchema = Type.Null();
|
||||
|
||||
type ReturnType = Static<typeof ReturnSchema>;
|
||||
import { Type } from '@sinclair/typebox';
|
||||
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
||||
|
||||
// 兼容性代码
|
||||
export class GoCQHTTPSetModelShow extends OneBotAction<PayloadType, ReturnType> {
|
||||
export class GoCQHTTPSetModelShow extends OneBotAction<void, void> {
|
||||
override actionName = ActionName.GoCQHTTP_SetModelShow;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override payloadSchema = Type.Object({});
|
||||
override returnSchema = Type.Null();
|
||||
override actionSummary = '设置机型';
|
||||
override actionDescription = '设置当前账号的设备机型名称;当前兼容实现不执行实际切换';
|
||||
override actionDescription = '设置当前账号的设备机型名称';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = {};
|
||||
override returnExample = null;
|
||||
override payloadExample = GoCQHTTPActionsExamples.GoCQHTTPSetModelShow.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GoCQHTTPSetModelShow.response;
|
||||
|
||||
async _handle () {
|
||||
|
||||
async _handle (): Promise<ReturnType> {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,14 @@
|
||||
import type { OB11MessageMixType } from '@/napcat-onebot/types';
|
||||
import {
|
||||
ContextMode,
|
||||
normalize,
|
||||
ReturnDataType,
|
||||
SendMsgBase,
|
||||
SendMsgPayload,
|
||||
SendMsgPayloadSchema,
|
||||
} from '@/napcat-onebot/action/msg/SendMsg';
|
||||
import { OB11MessageMixType } from '@/napcat-onebot/types';
|
||||
import { ContextMode, normalize, ReturnDataType, SendMsgBase, SendMsgPayload } from '@/napcat-onebot/action/msg/SendMsg';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import type { BaseCheckResult } from '@/napcat-onebot/action/router';
|
||||
import { OB11MessageMixTypeSchema } from '@/napcat-onebot/types/message';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
const GoCQHTTPSendForwardPayloadSchema = Type.Intersect([
|
||||
Type.Omit(SendMsgPayloadSchema, ['message']),
|
||||
Type.Object({
|
||||
messages: OB11MessageMixTypeSchema,
|
||||
}),
|
||||
]);
|
||||
|
||||
type GoCQHTTPSendForwardMsgPayload = Static<typeof GoCQHTTPSendForwardPayloadSchema> & {
|
||||
message?: OB11MessageMixType;
|
||||
};
|
||||
// 未验证
|
||||
type GoCQHTTPSendForwardMsgPayload = SendMsgPayload & { messages?: OB11MessageMixType; };
|
||||
|
||||
export class GoCQHTTPSendForwardMsgBase extends SendMsgBase {
|
||||
override payloadSchema = GoCQHTTPSendForwardPayloadSchema;
|
||||
|
||||
protected override getMessageForCheck (payload: SendMsgPayload): OB11MessageMixType {
|
||||
const forwardPayload = payload as SendMsgPayload & GoCQHTTPSendForwardMsgPayload;
|
||||
return normalize(forwardPayload.messages);
|
||||
protected override async check (payload: GoCQHTTPSendForwardMsgPayload) {
|
||||
if (payload.messages) payload.message = normalize(payload.messages);
|
||||
return super.check(payload);
|
||||
}
|
||||
}
|
||||
export class GoCQHTTPSendForwardMsg extends GoCQHTTPSendForwardMsgBase {
|
||||
@@ -44,6 +24,11 @@ export class GoCQHTTPSendForwardMsg extends GoCQHTTPSendForwardMsgBase {
|
||||
override returnExample = {
|
||||
message_id: 123456,
|
||||
};
|
||||
|
||||
protected override async check (payload: GoCQHTTPSendForwardMsgPayload) {
|
||||
if (payload.messages) payload.message = normalize(payload.messages);
|
||||
return super.check(payload);
|
||||
}
|
||||
}
|
||||
export class GoCQHTTPSendPrivateForwardMsg extends GoCQHTTPSendForwardMsgBase {
|
||||
override actionName = ActionName.GoCQHTTP_SendPrivateForwardMsg;
|
||||
@@ -58,18 +43,7 @@ export class GoCQHTTPSendPrivateForwardMsg extends GoCQHTTPSendForwardMsgBase {
|
||||
message_id: 123456,
|
||||
};
|
||||
|
||||
protected override async check (payload: SendMsgPayload): Promise<BaseCheckResult> {
|
||||
payload.message_type = 'private';
|
||||
if (!payload.user_id) {
|
||||
return {
|
||||
valid: false,
|
||||
message: '缺少参数 user_id',
|
||||
};
|
||||
}
|
||||
return super.check(payload);
|
||||
}
|
||||
|
||||
override async _handle (payload: SendMsgPayload): Promise<ReturnDataType> {
|
||||
override async _handle (payload: GoCQHTTPSendForwardMsgPayload): Promise<ReturnDataType> {
|
||||
return this.base_handle(payload, ContextMode.Private);
|
||||
}
|
||||
}
|
||||
@@ -87,18 +61,7 @@ export class GoCQHTTPSendGroupForwardMsg extends GoCQHTTPSendForwardMsgBase {
|
||||
message_id: 123456,
|
||||
};
|
||||
|
||||
protected override async check (payload: SendMsgPayload): Promise<BaseCheckResult> {
|
||||
payload.message_type = 'group';
|
||||
if (!payload.group_id) {
|
||||
return {
|
||||
valid: false,
|
||||
message: '缺少参数 group_id',
|
||||
};
|
||||
}
|
||||
return super.check(payload);
|
||||
}
|
||||
|
||||
override async _handle (payload: SendMsgPayload): Promise<ReturnDataType> {
|
||||
override async _handle (payload: GoCQHTTPSendForwardMsgPayload): Promise<ReturnDataType> {
|
||||
return this.base_handle(payload, ContextMode.Group);
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,11 @@ export const SendGroupNoticePayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
content: Type.String({ description: '公告内容' }),
|
||||
image: Type.Optional(Type.String({ description: '公告图片路径或 URL' })),
|
||||
pinned: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 0, description: '是否置顶 (0/1)' })),
|
||||
type: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 1, description: '类型 (默认为 1)' })),
|
||||
confirm_required: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 1, description: '是否需要确认 (0/1)' })),
|
||||
is_show_edit_card: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 0, description: '是否显示修改群名片引导 (0/1)' })),
|
||||
tip_window_type: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 0, description: '弹窗类型 (默认为 0)' })),
|
||||
pinned: Type.Union([Type.Number(), Type.String()], { default: 0, description: '是否置顶 (0/1)' }),
|
||||
type: Type.Union([Type.Number(), Type.String()], { default: 1, description: '类型 (默认为 1)' }),
|
||||
confirm_required: Type.Union([Type.Number(), Type.String()], { default: 1, description: '是否需要确认 (0/1)' }),
|
||||
is_show_edit_card: Type.Union([Type.Number(), Type.String()], { default: 0, description: '是否显示修改群名片引导 (0/1)' }),
|
||||
tip_window_type: Type.Union([Type.Number(), Type.String()], { default: 0, description: '弹窗类型 (默认为 0)' }),
|
||||
});
|
||||
|
||||
export type SendGroupNoticePayload = Static<typeof SendGroupNoticePayloadSchema>;
|
||||
@@ -29,11 +29,6 @@ export class SendGroupNotice extends OneBotAction<SendGroupNoticePayload, void>
|
||||
override returnExample = GoCQHTTPActionsExamples.SendGroupNotice.response;
|
||||
|
||||
async _handle (payload: SendGroupNoticePayload) {
|
||||
const pinned = payload.pinned!;
|
||||
const type = payload.type!;
|
||||
const confirmRequired = payload.confirm_required!;
|
||||
const showEditCard = payload.is_show_edit_card!;
|
||||
const tipWindowType = payload.tip_window_type!;
|
||||
let UploadImage: { id: string, width: number, height: number; } | undefined;
|
||||
if (payload.image) {
|
||||
// 公告图逻辑
|
||||
@@ -61,11 +56,11 @@ export class SendGroupNotice extends OneBotAction<SendGroupNoticePayload, void>
|
||||
const publishGroupBulletinResult = await this.core.apis.WebApi.setGroupNotice(
|
||||
payload.group_id.toString(),
|
||||
payload.content,
|
||||
+pinned,
|
||||
+type,
|
||||
+showEditCard,
|
||||
+tipWindowType,
|
||||
+confirmRequired,
|
||||
+payload.pinned,
|
||||
+payload.type,
|
||||
+payload.is_show_edit_card,
|
||||
+payload.tip_window_type,
|
||||
+payload.confirm_required,
|
||||
UploadImage?.id,
|
||||
UploadImage?.width,
|
||||
UploadImage?.height
|
||||
|
||||
@@ -13,7 +13,7 @@ export const GoCQHTTPUploadGroupFilePayloadSchema = Type.Object({
|
||||
name: Type.String({ description: '文件名' }),
|
||||
folder: Type.Optional(Type.String({ description: '父目录 ID' })),
|
||||
folder_id: Type.Optional(Type.String({ description: '父目录 ID (兼容性字段)' })), // 临时扩展
|
||||
upload_file: Type.Optional(Type.Boolean({ default: true, description: '是否执行上传' })),
|
||||
upload_file: Type.Boolean({ default: true, description: '是否执行上传' }),
|
||||
});
|
||||
|
||||
export type GoCQHTTPUploadGroupFilePayload = Static<typeof GoCQHTTPUploadGroupFilePayloadSchema>;
|
||||
|
||||
@@ -12,7 +12,7 @@ export const GoCQHTTPUploadPrivateFilePayloadSchema = Type.Object({
|
||||
user_id: Type.String({ description: '用户 QQ' }),
|
||||
file: Type.String({ description: '资源路径或URL' }),
|
||||
name: Type.String({ description: '文件名' }),
|
||||
upload_file: Type.Optional(Type.Boolean({ default: true, description: '是否执行上传' })),
|
||||
upload_file: Type.Boolean({ default: true, description: '是否执行上传' }),
|
||||
});
|
||||
|
||||
export type GoCQHTTPUploadPrivateFilePayload = Static<typeof GoCQHTTPUploadPrivateFilePayloadSchema>;
|
||||
|
||||
Reference in new issue
Block a user