This commit is contained in:
syuilo 2019-03-09 19:15:22 +09:00
parent 90afe8b0ad
commit 04756ab02e
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69

View file

@ -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();
} }