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

3
.gitignore vendored
View File

@ -1,6 +1,7 @@
# Develop
node_modules/
package-lock.json
pnpm-lock.yaml
out/
dist/
src/core.lib/common/
@ -13,4 +14,4 @@ test
# Build
*.db
checkVersion.sh
checkVersion.sh

View File

@ -314,6 +314,11 @@ export async function createSendElements(messageData: OB11MessageData[], group:
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);
logDebug('生成音乐消息', musicMsgElement);
if (musicMsgElement) {
@ -321,7 +326,6 @@ export async function createSendElements(messageData: OB11MessageData[], group:
}
}
}
}
return {

View File

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