Skip to content

Commit

Permalink
fix(qq): fix timestamp parsing (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
idranme authored Jul 17, 2024
1 parent 3bba22c commit 1080073
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion adapters/qq/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export function decodeGroupMessage(
message.content = message.elements.join('')

if (!payload) return message
const date = data.timestamp.slice(0, data.timestamp.indexOf('m=')).trim().replace(/\+(\d{4}) CST/, 'GMT+$1')
let date = data.timestamp
if (date.includes('m=')) {
date = data.timestamp.slice(0, data.timestamp.indexOf('m=')).trim().replace(/\+(\d{4}) CST/, 'GMT+$1')
}
payload.timestamp = new Date(date).valueOf()
payload.guild = data.group_id && { id: data.group_id }
payload.user = { id: data.author.id, avatar: `https://q.qlogo.cn/qqapp/${bot.config.id}/${data.author.id}/640` }
Expand Down

0 comments on commit 1080073

Please sign in to comment.