mirror of
https://github.com/wechaty/getting-started.git
synced 2026-10-18 14:34:32 +08:00
fix(examples): typescript errors of bless-twins-bot (#188)
This commit is contained in:
@@ -2,6 +2,13 @@
|
||||
|
||||
[](https://asciinema.org/a/177857)
|
||||
|
||||
### How to run
|
||||
|
||||
```bash
|
||||
npm install blessed blessed-contrib @types/blessed
|
||||
ts-node blessed-twins-bot.ts
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
* Example Source Code: <https://github.com/wechaty/wechaty-getting-started/tree/master/examples/professional/blessed-twins-bot>
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as contrib from 'blessed-contrib'
|
||||
import { generate } from 'qrcode-terminal'
|
||||
|
||||
import {
|
||||
Wechaty,
|
||||
Wechaty, WechatyOptions,
|
||||
} from 'wechaty'
|
||||
|
||||
const screen = blessed.screen({
|
||||
@@ -222,7 +222,7 @@ setInterval(function() {
|
||||
const text = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L']
|
||||
|
||||
const value = Math.round(Math.random() * 100)
|
||||
lcdLineOne.setDisplay(value + text[value % 12])
|
||||
lcdLineOne.setDisplay(value + text[value % 12]!)
|
||||
lcdLineOne.setOptions({
|
||||
color: colors[value % 5],
|
||||
elementPadding: 4,
|
||||
@@ -298,8 +298,8 @@ screen.render()
|
||||
*
|
||||
*
|
||||
*/
|
||||
const boy = new Wechaty({ profile: 'boy' })
|
||||
const girl = new Wechaty({ profile: 'girl' })
|
||||
const boy = new Wechaty({ profile: 'boy' } as WechatyOptions)
|
||||
const girl = new Wechaty({ profile: 'girl' } as WechatyOptions)
|
||||
|
||||
startBot(boy, boyConsole)
|
||||
startBot(girl, girlConsole)
|
||||
|
||||
Reference in New Issue
Block a user