mirror of
https://github.com/nullnyat/NullcatChan.git
synced 2025-04-29 08:17:23 +09:00
Merge pull request #4 from syobocat/dev
[fix] Correct some weird behavior
This commit is contained in:
commit
5d89d8f6e5
10
README.md
10
README.md
@ -34,11 +34,11 @@ Misskey用の[Aiベース](https://github.com/syuilo/ai)のBotです。
|
|||||||
"master": "管理者のユーザー名(オプション)",
|
"master": "管理者のユーザー名(オプション)",
|
||||||
"notingEnabled": "ランダムにノートを投稿する機能。true(on) or false(off)",
|
"notingEnabled": "ランダムにノートを投稿する機能。true(on) or false(off)",
|
||||||
"keywordEnabled": "キーワードを覚える機能 (MeCab が必要) true or false",
|
"keywordEnabled": "キーワードを覚える機能 (MeCab が必要) true or false",
|
||||||
"serverMonitoring": "サーバー監視の機能(重かったりすると教えてくれるよ。)true or false",
|
"serverMonitoring": "サーバー監視の機能(重かったりすると教えてくれるよ。)true or false",
|
||||||
"mecab": "MeCab のインストールパス (ソースからインストールした場合、大体は /usr/local/bin/mecab) ",
|
"mecab": "MeCab のインストールパス (ソースからインストールした場合、大体は /usr/local/bin/mecab) ",
|
||||||
"mecabDic": "MeCab の辞書ファイルパス",
|
"mecabDic": "MeCab の辞書ファイルパス(オプション)",
|
||||||
"memoryDir": "memory.jsonの保存先(オプション、デフォルトは'.'(レポジトリのルートです))",
|
"memoryDir": "memory.jsonの保存先(オプション、デフォルトは'.'(レポジトリのルートです))",
|
||||||
"shellgeiUrl": "シェル芸BotのAPIのURLです(デフォルトではhttps://websh.jiro4989.com/api/shellgei)"
|
"shellgeiUrl": "シェル芸BotのAPIのURLです(オプション、デフォルトはhttps://websh.jiro4989.com/api/shellgei)"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
`npm install` して `npm run build` して `npm start` すれば起動できます。
|
`npm install` して `npm run build` して `npm start` すれば起動できます。
|
||||||
@ -57,7 +57,7 @@ Misskey用の[Aiベース](https://github.com/syuilo/ai)のBotです。
|
|||||||
"mecab": "/usr/bin/mecab",
|
"mecab": "/usr/bin/mecab",
|
||||||
"mecabDic": "/usr/lib/x86_64-linux-gnu/mecab/dic/mecab-ipadic-neologd/",
|
"mecabDic": "/usr/lib/x86_64-linux-gnu/mecab/dic/mecab-ipadic-neologd/",
|
||||||
"memoryDir": "data",
|
"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>
|
`npm install` して `npm run docker` すれば起動できます。<br>
|
||||||
|
@ -10,7 +10,7 @@ type Config = {
|
|||||||
mecab?: string;
|
mecab?: string;
|
||||||
mecabDic?: string;
|
mecabDic?: string;
|
||||||
memoryDir?: string;
|
memoryDir?: string;
|
||||||
shellgeiUrl: string;
|
shellgeiUrl?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const config = require('../config.json');
|
const config = require('../config.json');
|
||||||
|
@ -51,7 +51,7 @@ function log(msg: string): void {
|
|||||||
_log(`[Boot]: ${msg}`);
|
_log(`[Boot]: ${msg}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
log(chalk.bold(`Nullcat chan! v${pkg._v}`));
|
log(chalk.bold(`Nullcat chan! v${pkg.version}`));
|
||||||
|
|
||||||
promiseRetry(
|
promiseRetry(
|
||||||
retry => {
|
retry => {
|
||||||
|
@ -32,11 +32,14 @@ export default class extends Module {
|
|||||||
this.log(shellText);
|
this.log(shellText);
|
||||||
const shellgeiBody = { code: shellText, images: [] };
|
const shellgeiBody = { code: shellText, images: [] };
|
||||||
const shellgeiOptions = { method: 'POST', body: JSON.stringify(shellgeiBody), headers: { 'Content-Type': 'application/json' } };
|
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 () => {
|
await (async () => {
|
||||||
try {
|
try {
|
||||||
const shellgeiResult = await fetch(shellgeiURL, shellgeiOptions);
|
const shellgeiResult = await fetch(shellgeiUrl, shellgeiOptions);
|
||||||
const shellgeiResultJson: any = await shellgeiResult.json();
|
const shellgeiResultJson: any = await shellgeiResult.json();
|
||||||
const shellgeiResultStdOut = shellgeiResultJson.stdout;
|
const shellgeiResultStdOut = shellgeiResultJson.stdout;
|
||||||
const shellgeiResultStdErr = shellgeiResultJson.stderr;
|
const shellgeiResultStdErr = shellgeiResultJson.stderr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user