Skip to content

Commit

Permalink
chore: 戳一戳优化
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Dec 18, 2024
1 parent 64940dd commit 8a1d2fc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion main/src/controllers/ForwardController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {

} from '../client/QQClient';
import posthog from '../models/posthog';
import env from '../models/env';

export default class ForwardController {
private readonly forwardService: ForwardService;
Expand Down Expand Up @@ -210,18 +211,27 @@ export default class ForwardController {
const operator = chat.pickMember(event.fromId);
let operatorInfo = await operator.renew();
operatorName = operatorInfo.card || operatorInfo.nickname;
if (!((pair.flags | this.instance.flags) & flags.DISABLE_RICH_HEADER) && env.WEB_ENDPOINT) {
const richHeaderUrl = helper.generateRichHeaderUrl(pair.apiKey, operatorInfo.user_id, operatorName);
operatorName = `<a href="${richHeaderUrl}">${operatorName}</a>`;
}
if (event.fromId === event.targetId) {
targetName = '自己';
}
else {
const targetUser = chat.pickMember(event.targetId);
let targetInfo = await targetUser.renew();
targetName = targetInfo.card || targetInfo.nickname;
if (!((pair.flags | this.instance.flags) & flags.DISABLE_RICH_HEADER) && env.WEB_ENDPOINT) {
const richHeaderUrl = helper.generateRichHeaderUrl(pair.apiKey, targetInfo.user_id, targetName);
targetName = `<a href="${richHeaderUrl}">${targetName}</a>`;
}
}
}
await pair.tg.sendMessage({
message: `<i><b>${operatorName}</b>${event.action}<b>${targetName}</b>${event.suffix}</i>`,
message: `<i><b>${operatorName}</b>${event.action || '戳了戳'}<b>${targetName}</b>${event.suffix || ''}</i>`,
silent: true,
linkPreview: false,
});
};
}

0 comments on commit 8a1d2fc

Please sign in to comment.