Skip to content

Commit

Permalink
fix: nt 语音
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Sep 5, 2024
1 parent 232db43 commit cbdd0a9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
},
"dependencies": {
"@bogeychan/elysia-polyfills": "^0.6.4",
"@icqqjs/icqq": "file:..\\patches\\icqqjs-icqq-1.2.6.tgz",
"@icqqjs/icqq": "file:..\\patches\\icqqjs-icqq-1.2.6-r2.tgz",
"@prisma/client": "5.19.0",
"dockerode": "^4.0.2",
"prisma": "5.19.0",
Expand Down
9 changes: 8 additions & 1 deletion main/src/services/ForwardService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Quotable,
segment,
} from '@icqqjs/icqq';
import { Contactable } from '@icqqjs/icqq/lib/internal';
import { fetchFile, getBigFaceUrl, getImageUrlByMd5, isContainsUrl } from '../utils/urls';
import { ButtonLike, FileLike } from 'telegram/define';
import { getLogger, Logger } from 'log4js';
Expand Down Expand Up @@ -348,7 +349,10 @@ export default class ForwardService {
}
case 'record': {
url = elem.url;
if (!url && this.oicq instanceof OicqClient) {
if (!url && pair.qq instanceof Contactable && elem.md5 === 'ntptt') {
url = await pair.qq.getNtVoiceUrl(elem.file as Buffer);
}
else if (!url && this.oicq instanceof OicqClient) {
const refetchMessage = await this.oicq.oicq.getMsg(event.messageId);
url = (refetchMessage.message.find(it => it.type === 'record') as PttElem).url;
}
Expand Down Expand Up @@ -438,6 +442,9 @@ export default class ForwardService {
}
}
message = message.trim();
if (!event.message.length) {
message += '<i>[消息无法解析出内容]</i>';
}

// 处理回复
if (event.replyTo) {
Expand Down
Binary file added patches/icqqjs-icqq-1.2.6-r2.tgz
Binary file not shown.
Binary file removed patches/icqqjs-icqq-1.2.6.tgz
Binary file not shown.
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cbdd0a9

Please sign in to comment.