From 04756ab02ef6e82d5457f78c7aa27cd718da6adc Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 9 Mar 2019 19:15:22 +0900 Subject: [PATCH] Fix #29 --- src/message.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/message.ts b/src/message.ts index 4b55816..ca0859b 100644 --- a/src/message.ts +++ b/src/message.ts @@ -5,6 +5,7 @@ import { User } from './misskey/user'; import includes from './utils/includes'; import or from './utils/or'; import chalk from 'chalk'; +import config from './config'; const delay = require('timeout-as-promise'); export default class Message { @@ -29,8 +30,10 @@ export default class Message { } public get extractedText(): string { + const host = new URL(config.host).host.replace(/\./g, '\\.'); 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(); }