名前を憶えてくれない問題を仮修正
This commit is contained in:
parent
96685d0707
commit
091a45e561
|
@ -15,6 +15,9 @@ Misskey用の日本語Bot、「藍」の[えとねるん](https://msk.ilnk.info)
|
||||||
|
|
||||||
他のサーバーで使用する場合には[バニラの藍](https://github.com/syuilo/ai)をお勧めします。
|
他のサーバーで使用する場合には[バニラの藍](https://github.com/syuilo/ai)をお勧めします。
|
||||||
|
|
||||||
|
## インストール時の注意点
|
||||||
|
* MeCabのダウンロードがOSDN死にかけのせいでとても遅いです。これも何とかしたかったのですがAPTパッケージら辺から改造しないと駄目そうなので断念しました
|
||||||
|
|
||||||
## インストール
|
## インストール
|
||||||
> Node.js と npm と MeCab (オプション) がインストールされている必要があります。
|
> Node.js と npm と MeCab (オプション) がインストールされている必要があります。
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import Message from '@/message.js';
|
||||||
import serifs from '@/serifs.js';
|
import serifs from '@/serifs.js';
|
||||||
import { safeForInterpolate } from '@/utils/safe-for-interpolate.js';
|
import { safeForInterpolate } from '@/utils/safe-for-interpolate.js';
|
||||||
|
|
||||||
const titles = ['さん', 'くん', '君', 'ちゃん', '様', '先生'];
|
const titles = ['さん', 'くん', '君', 'ちゃん', '様', '先生', '同志'];
|
||||||
|
|
||||||
export default class extends Module {
|
export default class extends Module {
|
||||||
public readonly name = 'core';
|
public readonly name = 'core';
|
||||||
|
@ -61,12 +61,15 @@ export default class extends Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private setName(msg: Message): boolean {
|
private setName(msg: Message): boolean {
|
||||||
if (!msg.text) return false;
|
if (!msg.text) return false;
|
||||||
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(/^(.+?)って呼んで/g)![1];
|
// 修正: グローバルフラグを削除し、マッチング結果を確認
|
||||||
|
const match = msg.text.match(/^(.+?)って呼んで/);
|
||||||
|
if (!match) return false; // マッチしていなければfalseを返す
|
||||||
|
const name = match[1]; // 安全にアクセス
|
||||||
|
|
||||||
if (name.length > 10) {
|
if (name.length > 10) {
|
||||||
msg.reply(serifs.core.tooLong);
|
msg.reply(serifs.core.tooLong);
|
||||||
|
@ -94,6 +97,7 @@ export default class extends Module {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private modules(msg: Message): boolean {
|
private modules(msg: Message): boolean {
|
||||||
if (!msg.text) return false;
|
if (!msg.text) return false;
|
||||||
|
|
Loading…
Reference in New Issue