getting-started
getting-started copied to clipboard
Runing locally ding-dong-bot not work
##Env: "qrcode-terminal": "^0.12.0", "wechaty": "^1.18.1", "wechaty-puppet-wechat": "^1.18.1" "node":v16.14.2 OS:Windows10 npm:8.5.0
##reproduce:
mkdir ding-dong-bot
cd ding-dong-bot
npm init -y
npm install wechaty
npm install qrcode-terminal
npm install wechaty-puppet-wechat
(Create a new file ding-dong-bot.ts. Write the code)
set WECHATY_LOG=verbose
set WECHATY_PUPPET=wechaty-puppet-wechat
ts-node ding-dong-bot.ts
##Err:
C:\Users\86180\Desktop\ding-dong-bot>ts-node ding-dong-bot.ts
C:\Users\86180\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:820
return new TSError(diagnosticText, diagnosticCodes);
^
TSError: ⨯ Unable to compile TypeScript:
ding-dong-bot.ts:9:28 - error TS7016: Could not find a declaration file for module 'qrcode-terminal'. 'C:/Users/86180/Desktop/ding-dong-bot/node_modules/qrcode-terminal/lib/main.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/qrcode-terminal` if it exists or add a new declaration (.d.ts) file containing `declare module 'qrcode-terminal';`
9 import { generate } from 'qrcode-terminal'
~~~~~~~~~~~~~~~~~
ding-dong-bot.ts:44:19 - error TS2693: 'Wechaty' only refers to a type, but is being used as a value here.
44 const bot = new Wechaty({
~~~~~~~
ding-dong-bot.ts:55:10 - error TS7006: Parameter 'e' implicitly has an 'any' type.
55 .catch(e => log.error('StarterBot', e))
~
at createTSError (C:\Users\86180\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:820:12)
at reportTSError (C:\Users\86180\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:824:19)
at getOutput (C:\Users\86180\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1014:36)
at Object.compile (C:\Users\86180\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1322:43)
at Module.m._compile (C:\Users\86180\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1454:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\86180\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1458:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
diagnosticCodes: [ 7016, 2693, 7006 ]
}
To get started with Wechaty on your first time, it is recommended to use this repo by following the docs at https://wechaty.js.org/docs/getting-started/
TL;DR:
git clone [email protected]:wechaty/getting-started.git
cd getting-started
npm install
npm start
Please feel free to let me know whether the above information can solve your problem.
I tried as you said. I try out the ding-dong-bot on my local system following the steps on the webpage. However, there are some errors as well.
##reproduce
git clone https://github.com/wechaty/wechaty-getting-started
cd wechaty-getting-started
npm install
npm start
##err
PS C:\Users\86180\wechaty-getting-started> npm start
> [email protected] start
> cross-env NODE_OPTIONS="--no-warnings --loader=ts-node/esm" node examples/ding-dong-bot.ts
21:09:36 INFO StarterBot Starter Bot Started.
21:09:36 INFO StarterBot onScan: Waiting(2) - https://wechaty.js.org/qrcode/https%3A%2F%2Flogin.weixin.qq.com%2Fl%2FgaBo1jGhIQ%3D%3D
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▀█ █▄▀▀ ▄█▀▄ █ ▄▄▄▄▄ █
█ █ █ █▀▀▀█ ▀ ██▀▀█▀█ █ █ █
█ █▄▄▄█ █▀ █▀▀▄█▀ ▄▄▄█ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄▀ ▀▄█▄▀▄█ ▀ █▄▄▄▄▄▄▄█
█ ▄█▄ ▄▄▀▄▀▀▄▄▄▄▀ █ ▀ ▀▄█▄▀█
█ ▀▄█ ▄▄███▄█▀█▀▄ ▄▄▀▀▀ ▄▄▀█▀██
█ ▀▀▀ █▄▀ ▄█▄█ █▀ ▀ ▀ ▀▀▀▄▄█▀█
█▀▀▀▀▀▄▄▄▀▀█ ▄█▀▄█▄██▄▀ ▀▄▄▀██
█▀█ █▄ ▄▄▀▀▄▄▀ ▀ ▀ ▀ ▀█▀▀▀▄ █▀█
█ █ ▀▄ ▄ ▀▄▄█▀█ ▄█████▀ ██▄▀██
█▄███▄▄▄▄ █▄█▄ ▀▄▀ ▄▄▄ ▀ █
█ ▄▄▄▄▄ █▄█ ▄█ ▄ ▄█ █▄█ ▄▄▀▀█
█ █ █ █ █▄▀▀█▄▀ ▀▀▄▄▄▄▄▀ █
█ █▄▄▄█ █ ▄█▀ ▄▄ █▀█ ▄▄▄ ▄ ██
█▄▄▄▄▄▄▄█▄▄██▄█▄██▄▄▄███▄██▄███
21:09:48 INFO StarterBot onScan: Scanned(3)
uncaughtException AssertionError [ERR_ASSERTION]: 1 == 0
at Object.equal (C:\Users\86180\wechaty-getting-started\node_modules\wechat4u\src\util\global.js:53:14)
at C:\Users\86180\wechaty-getting-started\node_modules\wechat4u\src\core.js:179:16
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 2,
details: 'AssertionError [ERR_ASSERTION]: 1 == 0\n' +
' at Object.equal (C:\\Users\\86180\\wechaty-getting-started\\node_modules\\wechat4u\\src\\util\\global.js:53:14)\n' +
' at C:\\Users\\86180\\wechaty-getting-started\\node_modules\\wechat4u\\src\\core.js:179:16\n' +
' at processTicksAndRejections (node:internal/process/task_queues:96:5)'
}
##编译器对ding-dong-bot.ts文档的报错如下
无法找到模块“qrcode-terminal”的声明文件。“C:/Users/86180/wechaty-getting-started/node_modules/qrcode-terminal/lib/main.js”隐式拥有 "any" 类型。
尝试使用 npm i --save-dev @types/qrcode-terminal (如果存在),或者添加一个包含 declare module 'qrcode-terminal'; 的新声明(.d.ts)文件",
Yes, I have the same problem with @hanqdemo
I also have this problem running on Gitpod, which just click open button and do nothing. Running on Gitpod
18:52:53 INFO StarterBot onScan: Scanned(3)
uncaughtException AssertionError [ERR_ASSERTION]: 1 == 0
at Object.equal (/Users/aoxiang/Desktop/getting-started/node_modules/wechat4u/src/util/global.js:53:14)
at /Users/aoxiang/Desktop/getting-started/node_modules/wechat4u/src/core.js:179:16
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 2,
details: 'AssertionError [ERR_ASSERTION]: 1 == 0\n' +
' at Object.equal (/Users/aoxiang/Desktop/getting-started/node_modules/wechat4u/src/util/global.js:53:14)\n' +
' at /Users/aoxiang/Desktop/getting-started/node_modules/wechat4u/src/core.js:179:16\n' +
' at processTicksAndRejections (node:internal/process/task_queues:96:5)'
}
I have the same problem when i scan the qrcode
To get started with Wechaty on your first time, it is recommended to use this repo by following the docs at https://wechaty.js.org/docs/getting-started/
TL;DR:
git clone [email protected]:wechaty/getting-started.git cd getting-started npm install npm startPlease feel free to let me know whether the above information can solve your problem.
I try the ding-dong-bot under the Env as follows, but the bot logout automatically after login.
Env:
"qrcode-terminal": "^0.12.0", "wechaty": "^1.18.1", "wechaty-puppet-service": "^1.18.2" "node":v16.14.2 OS:Windows10 npm:8.5.0
###reproduce:
set WECHATY_LOG=verbose
set WECHATY_PUPPET=wechaty-puppet-service
set WECHATY_PUPPET_SERVICE_TOKEN=puppet_paimon_04035954-23e3-4d30-924f-4ed6dc5d953f
Set WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT = true
Set WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_SERVER = true
Set options.tls.disable = true
npm start
###ERR 扫码登录之后的错误
15:16:51 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_LOGIN(25), payload(len:35)})
15:16:51 VERB PuppetLoginMixin login(wxid_1dzsss7f8dk622)
15:16:51 VERB PuppetService hookPayloadStore() this.on(login) contactId: "wxid_1dzsss7f8dk622"
15:16:51 VERB PayloadStore start(wxid_1dzsss7f8dk622)
15:16:51 VERB PoolifyMixin get pool() init pool
15:16:51 VERB PuppetService contactRawPayload(wxid_1dzsss7f8dk622)
15:16:51 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_HEARTBEAT(1), payload(len:80)})
15:16:51 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_READY(23), payload(len:16)})
15:16:51 VERB StateSwitch <WechatyReady> active(true) <- (false)
15:16:51 INFO StarterBot Contact<hollowhill> login
15:16:52 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_HEARTBEAT(1), payload(len:80)})
15:16:53 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_HEARTBEAT(1), payload(len:80)})
15:16:54 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_HEARTBEAT(1), payload(len:80)})
15:16:56 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_HEARTBEAT(1), payload(len:80)})
15:16:57 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_HEARTBEAT(1), payload(len:80)})
15:16:58 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_LOGOUT(26), payload(len:58)})
15:16:58 VERB PuppetService logout("logout called")
15:16:58 VERB PuppetLoginMixin logout(logout called)
15:16:58 VERB PuppetService hookPayloadStore() this.on(logout) contactId: "wxid_1dzsss7f8dk622"
15:16:58 VERB PayloadStore stop()
15:16:58 VERB StateSwitch <WechatyReady> inactive(true) <- (false)
15:16:58 INFO StarterBot Contact<hollowhill> logout
15:16:58 VERB PuppetService bridgeGrpcEventStream() eventStream.on(end)
15:17:58 WARN PuppetWatchdogAgent start() reset() reason: {"data":"onGrpcStreamEvent(EVENT_TYPE_LOGOUT)","timeoutMilliseconds":60000}
15:17:58 ERR Config ###########################
15:17:58 ERR Config Wechaty uncaughtException: Error: WatchdogAgent reset: lastFood: "{"data":"onGrpcStreamEvent(EVENT_TYPE_LOGOUT)","timeoutMilliseconds":60000}"
at Watchdog.reset (C:\Users\86180\Desktop\ding-dong-bot\node_modules\wechaty-puppet\src\agents\watchdog-agent.ts:65:33)
at Watchdog.emit (node:events:526:28)
at Watchdog.emit (node:domain:475:12)
at Timeout._onTimeout (C:\Users\86180\Desktop\ding-dong-bot\node_modules\watchdog\src\watchdog.ts:115:12)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) uncaughtException
15:17:58 ERR Config ###########################
I also have this problem
git clone [email protected]:wechaty/getting-started.git cd getting-started npm install npm start
set WECHATY_PUPPET=wechaty-puppet-padlocal set WECHATY_PUPPET_PADLOCAL_TOKEN='*****************************' npm start
16:04:39 INFO StarterBot onScan: Scanned(3) uncaughtException AssertionError [ERR_ASSERTION]: 1 == 0 at Object.equal (E:\github\wechaty\getting-started\node_modules\wechat4u\src\util\global.js:53:14) at E:\github\wechaty\getting-started\node_modules\wechat4u\src\core.js:179:16 at processTicksAndRejections (node:internal/process/task_queues:96:5) { code: 2, details: 'AssertionError [ERR_ASSERTION]: 1 == 0\n' + ' at Object.equal (E:\github\wechaty\getting-started\node_modules\wechat4u\src\util\global.js:53:14)\n' + ' at E:\github\wechaty\getting-started\node_modules\wechat4u\src\core.js:179:16\n' + ' at processTicksAndRejections (node:internal/process/task_queues:96:5)' }
I'm new here and I got the same exception
█ █ █ █▀▀▀ █▀▀ ▀▄█▀ ▄ ▀▄▄ █
█ █▄▄▄█ █ ▄ █ ▀▄█▀█ ▄ ██▄▀▀▄▀▄█
█▄▄▄▄▄▄▄█▄▄█▄███▄███▄▄▄██▄██▄██
uncaughtException AssertionError [ERR_ASSERTION]: 1 == 0
at Object.equal (/Users/helloint/workspace/getting-started/node_modules/wechat4u/src/util/global.js:53:14)
at /Users/helloint/workspace/getting-started/node_modules/wechat4u/src/core.js:179:16
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 2,
details: 'AssertionError [ERR_ASSERTION]: 1 == 0\n' +
' at Object.equal (/Users/helloint/workspace/getting-started/node_modules/wechat4u/src/util/global.js:53:14)\n' +
' at /Users/helloint/workspace/getting-started/node_modules/wechat4u/src/core.js:179:16\n' +
' at processTicksAndRejections (node:internal/process/task_queues:96:5)'
}
I believe this is because of the web protocol issue. I'm using a new wechat account, for security concern, and this account's web protocol is disabled. Looks like wechat disabled web protocol for all the new accounts. I tried the old wechart account in the same way and it works fine.
same as https://github.com/wechaty/getting-started/issues/271