mirror of
https://github.com/syuilo/ai.git
synced 2024-11-09 15:38:00 +00:00
Fix #29
This commit is contained in:
parent
90afe8b0ad
commit
04756ab02e
|
@ -5,6 +5,7 @@ import { User } from './misskey/user';
|
||||||
import includes from './utils/includes';
|
import includes from './utils/includes';
|
||||||
import or from './utils/or';
|
import or from './utils/or';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
|
import config from './config';
|
||||||
const delay = require('timeout-as-promise');
|
const delay = require('timeout-as-promise');
|
||||||
|
|
||||||
export default class Message {
|
export default class Message {
|
||||||
|
@ -29,8 +30,10 @@ export default class Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
public get extractedText(): string {
|
public get extractedText(): string {
|
||||||
|
const host = new URL(config.host).host.replace(/\./g, '\\.');
|
||||||
return this.text
|
return this.text
|
||||||
.replace(new RegExp(`^@${this.ai.account.username}(@.+?)?\s?`, 'i'), '')
|
.replace(new RegExp(`^@${this.ai.account.username}@${host}\\s`, 'i'), '')
|
||||||
|
.replace(new RegExp(`^@${this.ai.account.username}\\s`, 'i'), '')
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue