Skip to content

Commit

Permalink
chore: / 命令在 tg 中增加链接
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Jan 21, 2025
1 parent 0da4805 commit 016a1b5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main/src/controllers/HugController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { getLogger, Logger } from 'log4js';
import flags from '../constants/flags';
import { MessageEvent, QQClient, Group, GroupMemberInfo, Sendable } from '../client/QQClient';
import { Member as OicqMember } from '@icqqjs/icqq/lib/member';
import env from '../models/env';
import forwardHelper from '../helpers/forwardHelper';

type ActionSubjectTg = {
name: string;
Expand Down Expand Up @@ -189,6 +191,13 @@ export default class {
text: subject.name,
qq: subject.id,
});
if (!((pair.flags | this.instance.flags) & flags.DISABLE_RICH_HEADER) && env.WEB_ENDPOINT) {
tgEntities.push(new Api.MessageEntityTextUrl({
offset: tgText.length,
length: subject.name.length,
url: forwardHelper.generateRichHeaderUrl(pair.apiKey, subject.id, subject.name),
}));
}
}
tgText += subject.name;
};
Expand Down

0 comments on commit 016a1b5

Please sign in to comment.