mirror of
https://github.com/syuilo/ai.git
synced 2025-03-25 21:12:56 +00:00
feat: エラー落ちしないようにする
This commit is contained in:
parent
148d788760
commit
7f930320a3
1 changed files with 14 additions and 8 deletions
|
@ -66,16 +66,22 @@ export default class extends Module {
|
||||||
if (!msg.text.includes('って呼んで')) return false;
|
if (!msg.text.includes('って呼んで')) return false;
|
||||||
if (msg.text.startsWith('って呼んで')) return false;
|
if (msg.text.startsWith('って呼んで')) return false;
|
||||||
|
|
||||||
const name = msg.text.match(/^(.+?)って呼んで/)![1];
|
const matchResult = msg.text.match(/^(.+?)って呼んで/)![1];
|
||||||
|
|
||||||
if (name.length > 10) {
|
if (matchResult !== null) {
|
||||||
msg.reply(serifs.core.tooLong);
|
const name = matchResult[1];
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!safeForInterpolate(name)) {
|
if (name.length > 10) {
|
||||||
msg.reply(serifs.core.invalidName);
|
msg.reply(serifs.core.tooLong);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!safeForInterpolate(name)) {
|
||||||
|
msg.reply(serifs.core.invalidName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log("setName: 一致するものが見つかりませんでした")
|
||||||
}
|
}
|
||||||
|
|
||||||
const withSan = titles.some(t => name.endsWith(t));
|
const withSan = titles.some(t => name.endsWith(t));
|
||||||
|
|
Loading…
Reference in a new issue