From c9abd5b77dfe541eee2b02f6fd8aca67ca0544f4 Mon Sep 17 00:00:00 2001 From: n1lsqn Date: Sun, 12 Nov 2023 00:22:11 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=93=E6=B6=88=E3=81=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/core/index.ts | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/modules/core/index.ts b/src/modules/core/index.ts index 3c00c14..68fb47a 100644 --- a/src/modules/core/index.ts +++ b/src/modules/core/index.ts @@ -66,22 +66,16 @@ export default class extends Module { if (!msg.text.includes('って呼んで')) return false; if (msg.text.startsWith('って呼んで')) return false; - const matchResult = msg.text.match(/^(.+?)って呼んで/)![1]; + const name = msg.text.match(/^(.+?)って呼んで/)![1]; - if (matchResult !== null) { - const name = matchResult[1]; + if (name.length > 10) { + msg.reply(serifs.core.tooLong); + return true; + } - if (name.length > 10) { - msg.reply(serifs.core.tooLong); - return true; - } - - if (!safeForInterpolate(name)) { - msg.reply(serifs.core.invalidName); - return true; - } - } else { - console.log("setName: 一致するものが見つかりませんでした") + if (!safeForInterpolate(name)) { + msg.reply(serifs.core.invalidName); + return true; } const withSan = titles.some(t => name.endsWith(t));