diff --git a/README.md b/README.md index f083815..c001f8d 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,11 @@ Misskey用の[Aiベース](https://github.com/syuilo/ai)のBotです。 "master": "管理者のユーザー名(オプション)", "notingEnabled": "ランダムにノートを投稿する機能。true(on) or false(off)", "keywordEnabled": "キーワードを覚える機能 (MeCab が必要) true or false", - "serverMonitoring": "サーバー監視の機能(重かったりすると教えてくれるよ。)true or false", + "serverMonitoring": "サーバー監視の機能(重かったりすると教えてくれるよ。)true or false", "mecab": "MeCab のインストールパス (ソースからインストールした場合、大体は /usr/local/bin/mecab) ", - "mecabDic": "MeCab の辞書ファイルパス", - "memoryDir": "memory.jsonの保存先(オプション、デフォルトは'.'(レポジトリのルートです))", - "shellgeiUrl": "シェル芸BotのAPIのURLです(デフォルトではhttps://websh.jiro4989.com/api/shellgei)" + "mecabDic": "MeCab の辞書ファイルパス(オプション)", + "memoryDir": "memory.jsonの保存先(オプション、デフォルトは'.'(レポジトリのルートです))", + "shellgeiUrl": "シェル芸BotのAPIのURLです(オプション、デフォルトはhttps://websh.jiro4989.com/api/shellgei)" } ``` `npm install` して `npm run build` して `npm start` すれば起動できます。 @@ -57,7 +57,7 @@ Misskey用の[Aiベース](https://github.com/syuilo/ai)のBotです。 "mecab": "/usr/bin/mecab", "mecabDic": "/usr/lib/x86_64-linux-gnu/mecab/dic/mecab-ipadic-neologd/", "memoryDir": "data", - "shellgeiUrl": "シェル芸BotのAPIのURLです(デフォルトではhttps://websh.jiro4989.com/api/shellgei)" + "shellgeiUrl": "シェル芸BotのAPIのURLです(オプション、デフォルトではhttps://websh.jiro4989.com/api/shellgei)" } ``` `npm install` して `npm run docker` すれば起動できます。
diff --git a/src/config.ts b/src/config.ts index 44368c4..de39994 100644 --- a/src/config.ts +++ b/src/config.ts @@ -10,7 +10,7 @@ type Config = { mecab?: string; mecabDic?: string; memoryDir?: string; - shellgeiUrl: string; + shellgeiUrl?: string; }; const config = require('../config.json'); diff --git a/src/modules/shellgei/index.ts b/src/modules/shellgei/index.ts index b88cb94..b69b672 100644 --- a/src/modules/shellgei/index.ts +++ b/src/modules/shellgei/index.ts @@ -32,11 +32,14 @@ export default class extends Module { this.log(shellText); const shellgeiBody = { code: shellText, images: [] }; const shellgeiOptions = { method: 'POST', body: JSON.stringify(shellgeiBody), headers: { 'Content-Type': 'application/json' } }; - const shellgeiURL = config.shellgeiUrl; + let shellgeiUrl = 'https://websh.jiro4989.com/api/shellgei'; + if (config.shellgeiUrl) { + shellgeiUrl = config.shellgeiUrl; + } await (async () => { try { - const shellgeiResult = await fetch(shellgeiURL, shellgeiOptions); + const shellgeiResult = await fetch(shellgeiUrl, shellgeiOptions); const shellgeiResultJson: any = await shellgeiResult.json(); const shellgeiResultStdOut = shellgeiResultJson.stdout; const shellgeiResultStdErr = shellgeiResultJson.stderr;