style: 强类型大法

This commit is contained in:
手瓜一十雪 committed 2025-02-02 23:22:21 +08:00
1 parent ac193cc94a
commit 15854c605b
191 files changed
+923 -806

No files matched your search

+5 -2
View File
@@ -12,11 +12,14 @@ const SchemaData = Type.Object({
type Payload = Static<typeof SchemaData>;
export class GetAiRecord extends GetPacketStatusDepends<Payload, string> {
actionName = ActionName.GetAiRecord;
payloadSchema = SchemaData;
override actionName = ActionName.GetAiRecord;
override payloadSchema = SchemaData;
async _handle(payload: Payload) {
const rawRsp = await this.core.apis.PacketApi.pkt.operation.GetAiVoice(+payload.group_id, payload.character, payload.text, AIVoiceChatType.Sound);
if (!rawRsp.msgInfoBody[0]) {
throw new Error('No voice data');
}
return await this.core.apis.PacketApi.pkt.operation.GetGroupPttUrl(+payload.group_id, rawRsp.msgInfoBody[0].index);
}
}