Skip to content

Commit

Permalink
chore: / 指令支持使用 ¥ 触发,后缀始终加空格
Browse files Browse the repository at this point in the history
和神奇海螺表现一样
  • Loading branch information
clansty committed Jan 19, 2024
1 parent 4b3b0ac commit af2d02b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/controllers/HugController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ type ActionSubjectQq = {

type ActionSubject = ActionSubjectTg | ActionSubjectQq;

const COMMAND_REGEX = /(^\/([^\w\s$]\S*)|^\/\$(\w\S*))( (\S*))?/; // /抱 /$rua
const COMMAND_REGEX = /(^\/([^\w\s$¥]\S*)|^\/[$¥](\w\S*))( (\S*))?/; // /抱 /$rua

export default class {
private readonly log: Logger;

constructor(private readonly instance: Instance,
private readonly tgBot: Telegram,
private readonly oicq: OicqClient) {
Expand Down Expand Up @@ -76,7 +77,7 @@ export default class {
},
});
if (!sourceMessage) {
this.log.error('找不到 sourceMessage')
this.log.error('找不到 sourceMessage');
return true;
}
to = {
Expand Down Expand Up @@ -126,7 +127,7 @@ export default class {
},
});
if (!sourceMessage) {
this.log.error('找不到 sourceMessage')
this.log.error('找不到 sourceMessage');
return true;
}
if (this.tgBot.me.id.eq(sourceMessage.tgSenderId)) {
Expand Down Expand Up @@ -194,11 +195,7 @@ export default class {
addText('了 ');
addSubject(to);
if (suffix) {
if (!/[\u4e00-\u9fa5]$/.test(suffix) || !/[\u4e00-\u9fa5]$/.test(to.name)) {
// 英文之后加上空格
tgText += " ";
}
tgText += suffix;
tgText += ' ' + suffix;
}
addText('!');

Expand Down

0 comments on commit af2d02b

Please sign in to comment.