Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug(qq): 群消息中session.event.message.content未设置 #263

Closed
Hieuzest opened this issue Apr 17, 2024 · 1 comment
Closed

Bug(qq): 群消息中session.event.message.content未设置 #263

Hieuzest opened this issue Apr 17, 2024 · 1 comment

Comments

@Hieuzest
Copy link
Contributor

Hieuzest commented Apr 17, 2024

export function decodeGroupMessage(
bot: QQBot,
data: QQ.UserMessage,
message: Universal.Message = {},
payload: Universal.MessageLike = message,
) {
message.id = data.id
const date = data.timestamp.slice(0, data.timestamp.indexOf('m=')).trim().replace(/\+(\d{4}) CST/, 'GMT+$1')
message.timestamp = new Date(date).valueOf()
message.elements = []
if (data.content.length) message.elements.push(h.text(data.content))
for (const attachment of (data.attachments ?? [])) {
if (attachment.content_type === 'file') {
message.elements.push(h.file(attachment.url, {
filename: attachment.filename,
}))
} else if (attachment.content_type.startsWith('image/')) {
message.elements.push(h.image(attachment.url))
} else if (attachment.content_type === 'voice') {
message.elements.push(h.audio(attachment.url))
} else if (attachment.content_type === 'video') {
message.elements.push(h.video(attachment.url))
}
}
message.guild = { id: data.group_id }
message.user = { id: data.author.id }
return message
}

从而 qq over satori bridge 无法正常工作

@Hieuzest
Copy link
Contributor Author

cc @XxLittleCxX

@shigma shigma closed this as completed in 1c1716e Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant