Skip to content

Commit

Permalink
fix: napcat group video
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Jan 21, 2025
1 parent f0156e7 commit dd134d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 1 addition & 2 deletions main/src/controllers/TypingController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export default class TypingController {
if ((pair.flags | this.instance.flags) & flags.DISABLE_Q2TG) return;

if (event.typing) {
console.log(await pair.tg.setTyping())

await pair.tg.setTyping()
}
else {
await pair.tg.setTyping(new Api.SendMessageCancelAction());
Expand Down
16 changes: 13 additions & 3 deletions main/src/services/ForwardService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default class ForwardService {

private getStickerByQQFaceId(id: number | string, resultId?: number | string) {
for (const [pack, ids] of Object.entries(lottie.packInfo)) {
if(resultId && ids.includes(`${id}_${resultId}`)) {
if (resultId && ids.includes(`${id}_${resultId}`)) {
if (this.stickerPackMap[pack])
return this.stickerPackMap[pack][ids.indexOf(`${id}_${resultId}`)] as Api.Document;
}
Expand Down Expand Up @@ -325,10 +325,21 @@ export default class ForwardService {
}
case 'video':
// 先获取 URL,要传给下面
url = await pair.qq.getVideoUrl(elem.fid, elem.md5);
if (!(elem as any).url) {
url = await pair.qq.getVideoUrl(elem.fid, elem.md5);
}
case 'image':
if ('url' in elem)
url = elem.url;
if (this.oicq instanceof NapCatClient && !url.startsWith('http')) {
const ret = await this.oicq.callApi('download_file', { url: 'file://' + url });
url = ret.file;
tempFiles.push({
path: url,
fd: 0,
cleanup: () => fsP.unlink(url),
});
}
try {
if (elem.type === 'image' && elem.asface
&& !(elem.file as string).toLowerCase().endsWith('.gif')
Expand Down Expand Up @@ -920,7 +931,6 @@ export default class ForwardService {
let source: Quotable;
if (message.replyToMsgId || message.replyTo) {
try {
console.log(message.replyTo);
const quote = message.replyToMsgId && await db.message.findFirst({
where: {
tgChatId: Number(pair.tg.id),
Expand Down

0 comments on commit dd134d1

Please sign in to comment.