fix: custom music card content

This commit is contained in:
student_2333 2024-05-10 21:38:39 +08:00
parent f7307e8e01
commit c521269409
No known key found for this signature in database
GPG Key ID: B36E8DF853C33EE1
3 changed files with 8 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
# Develop # Develop
node_modules/ node_modules/
package-lock.json package-lock.json
pnpm-lock.yaml
out/ out/
dist/ dist/
src/core.lib/common/ src/core.lib/common/

View File

@ -314,6 +314,11 @@ export async function createSendElements(messageData: OB11MessageData[], group:
break; break;
} }
} }
const postData = { ...sendMsg.data } as IdMusicSignPostData | CustomMusicSignPostData;
if (sendMsg.data.type === 'custom' && sendMsg.data.content) {
(postData as CustomMusicSignPostData).singer = sendMsg.data.content;
delete (postData as OB11MessageCustomMusic['data']).content;
}
const musicMsgElement = await genMusicElement(sendMsg.data); const musicMsgElement = await genMusicElement(sendMsg.data);
logDebug('生成音乐消息', musicMsgElement); logDebug('生成音乐消息', musicMsgElement);
if (musicMsgElement) { if (musicMsgElement) {
@ -321,7 +326,6 @@ export async function createSendElements(messageData: OB11MessageData[], group:
} }
} }
} }
} }
return { return {

View File

@ -212,7 +212,7 @@ export interface OB11MessageIdMusic {
} }
export interface OB11MessageCustomMusic { export interface OB11MessageCustomMusic {
type: OB11MessageDataType.music type: OB11MessageDataType.music
data: CustomMusicSignPostData data: Omit<CustomMusicSignPostData, 'singer'> & { content?: string }
} }
export interface OB11MessageJson { export interface OB11MessageJson {