mirror of
https://github.com/nullnyat/NullcatChan.git
synced 2025-04-29 01:17:17 +09:00
make config.shellgeiUrl optional
This commit is contained in:
parent
598eb74ec1
commit
3767abc87b
10
README.md
10
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` すれば起動できます。<br>
|
||||
|
@ -10,7 +10,7 @@ type Config = {
|
||||
mecab?: string;
|
||||
mecabDic?: string;
|
||||
memoryDir?: string;
|
||||
shellgeiUrl: string;
|
||||
shellgeiUrl?: string;
|
||||
};
|
||||
|
||||
const config = require('../config.json');
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user