Skip to content

Commit

Permalink
Merge branch 'refs/heads/rainbowcat' into feat/napcat
Browse files Browse the repository at this point in the history
# Conflicts:
#	main/src/controllers/ForwardController.ts
  • Loading branch information
clansty committed Jul 11, 2024
2 parents ec4a69f + d28377d commit f486bf9
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions main/src/controllers/ForwardController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,30 @@ export default class ForwardController {
let { tgMessage, richHeaderUsed } = await this.forwardService.forwardFromQq(event, pair);
if (!tgMessage) return;
// 更新数据库
await db.message.create({
data: {
qqRoomId: pair.qqRoomId,
qqSenderId: event.from.id,
time: event.time,
brief: event.brief,
seq: event.seq,
rand: event.rand,
pktnum: event.pktnum,
tgChatId: pair.tgId,
tgMsgId: tgMessage.id,
instanceId: this.instance.id,
tgMessageText: tgMessage.message,
tgFileId: forwardHelper.getMessageDocumentId(tgMessage),
nick: event.from.name,
tgSenderId: BigInt(this.tgBot.me.id.toString()),
richHeaderUsed,
},
});
// 库的类型有问题
let tgMessages = tgMessage as undefined as Api.Message[];
if (!Array.isArray(tgMessages)) tgMessages = [tgMessage];
for (const tgMessage of tgMessages) {
await db.message.create({
data: {
qqRoomId: pair.qqRoomId,
qqSenderId: event.from.id,
time: event.time,
brief: event.brief,
seq: event.seq,
rand: event.rand,
pktnum: event.pktnum,
tgChatId: pair.tgId,
tgMsgId: tgMessage.id,
instanceId: this.instance.id,
tgMessageText: tgMessage.message,
tgFileId: forwardHelper.getMessageDocumentId(tgMessage),
nick: event.from.name,
tgSenderId: BigInt(this.tgBot.me.id.toString()),
richHeaderUsed,
},
});
}
await this.forwardService.addToZinc(pair.dbId, tgMessage.id, {
text: event.brief,
nick: event.from.name,
Expand Down

0 comments on commit f486bf9

Please sign in to comment.