UNPKG

2.1 kBJavaScriptView Raw
1#!/usr/bin/env node
2"use strict";
3/**
4 * Wechaty Chatbot SDK - https://github.com/wechaty/wechaty
5 *
6 * @copyright 2016 Huan LI (李卓桓) <https://github.com/huan>, and
7 * Wechaty Contributors <https://github.com/wechaty>.
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 */
22var __importDefault = (this && this.__importDefault) || function (mod) {
23 return (mod && mod.__esModule) ? mod : { "default": mod };
24};
25Object.defineProperty(exports, "__esModule", { value: true });
26const os_1 = __importDefault(require("os"));
27const config_1 = require("../src/config");
28const doctor_1 = require("../src/doctor");
29const wechaty_1 = require("../src/wechaty");
30const wechaty = wechaty_1.Wechaty.instance();
31const doctor = new doctor_1.Doctor();
32async function main() {
33 let ipcTestResult;
34 try {
35 await doctor.testTcp();
36 ipcTestResult = 'PASS';
37 }
38 catch (err) {
39 console.info(err);
40 ipcTestResult = 'FAIL. Please check your tcp network, Wechaty need to listen on localhost and connect to it.';
41 }
42 console.info(`
43 #### Wechaty Doctor
44
45 1. Wechaty version: ${wechaty.version()}
46 2. ${os_1.default.type()} ${os_1.default.arch()} version ${os_1.default.release()} memory ${Math.floor(os_1.default.freemem() / 1024 / 1024)}/${Math.floor(os_1.default.totalmem() / 1024 / 1024)} MB
47 3. Docker: ${config_1.config.docker}
48 4. Node version: ${process.version}
49 5. Tcp IPC TEST: ${ipcTestResult}
50
51 `);
52}
53main()
54 .catch(err => console.error('main() exception: %s', err));
55//# sourceMappingURL=doctor.js.map
\No newline at end of file