chore: / 指令支持使用 ¥ 触发,后缀始终加空格

和神奇海螺表现一样
This commit is contained in:
Clansty 2024-01-19 23:17:29 +08:00
parent 4b3b0ac9d5
commit af2d02b282
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
1 changed files with 5 additions and 8 deletions

View File

@ -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) {
@ -76,7 +77,7 @@ export default class {
},
});
if (!sourceMessage) {
this.log.error('找不到 sourceMessage')
this.log.error('找不到 sourceMessage');
return true;
}
to = {
@ -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)) {
@ -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('');