提交 39e5a8d5 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

merge

FROM ubuntu:17.10
LABEL maintainer="Huan LI <zixia@zixia.net>"
ENV NPM_CONFIG_LOGLEVEL warn
ENV DEBIAN_FRONTEND noninteractive
ENV LC_ALL C.UTF-8
ENV NODE_ENV $NODE_ENV
ENV NPM_CONFIG_LOGLEVEL warn
# Installing the 'apt-utils' package gets rid of the 'debconf: delaying package configuration, since apt-utils is not installed'
# error message when installing any other package with the apt-get package manager.
......@@ -10,10 +12,12 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-utils \
bash \
build-essential \
ca-certificates \
curl \
coreutils \
figlet \
git \
jq \
libav-tools \
moreutils \
......
FROM zixia/wechaty
RUN sudo mkdir /app/ \
&& sudo chown -R bot:bot /app/
WORKDIR /app/
ONBUILD ARG NODE_ENV
ONBUILD ENV NODE_ENV $NODE_ENV
ONBUILD WORKDIR /bot
ONBUILD COPY package.json .
ONBUILD RUN npm install && npm cache clean && rm -fr /tmp/* ~/.npm
ONBUILD COPY . .
......
......@@ -119,7 +119,7 @@ function wechaty::runBot() {
# NPM module install will have problem in China.
# i.e. chromedriver need to visit a google host to download binarys.
#
echo "Please make sure you had installed all the NPM modules which is depended by your bot script."
echo "Please make sure you had installed all the NPM modules which is depended on your bot script."
# yarn < /dev/null || return $? # yarn will close stdin??? cause `read` command fail after yarn
}
......
......@@ -50,13 +50,13 @@ const welcome = `
=============== Powered by Wechaty ===============
-------- https://github.com/chatie/wechaty --------
I'm a bot, my super power is talk in Wechat.
I'm a bot, my superpower is talk in Wechat.
If you send me a 'ding', I will reply you a 'dong'!
__________________________________________________
Hope you like it, and you are very welcome to
upgrade me for more super powers!
upgrade me to more superpowers!
Please wait... I'm trying to login in...
......@@ -68,7 +68,7 @@ const bot = Wechaty.instance({ profile: config.default.DEFAULT_PROFILE })
bot
.on('logout' , user => log.info('Bot', `${user.name()} logouted`))
.on('login' , user => {
log.info('Bot', `${user.name()} logined`)
log.info('Bot', `${user.name()} login`)
bot.say('Wechaty login').catch(console.error)
})
.on('scan', (url, code) => {
......@@ -76,7 +76,7 @@ bot
const loginUrl = url.replace(/\/qrcode\//, '/l/')
QrcodeTerminal.generate(loginUrl)
}
console.log(`${url}\n[${code}] Scan QR Code in above url to login: `)
console.log(`${url}\n[${code}] Scan QR Code above url to log in: `)
})
.on('message', async m => {
try {
......
{
"name": "wechaty",
"version": "0.12.3",
"version": "0.13.3",
"description": "Wechat for Bot(Personal Account)",
"main": "dist/index.js",
"types": "dist/index.d.ts",
......
......@@ -109,7 +109,7 @@ export class Contact implements Sayable {
private static pool = new Map<string, Contact>()
public obj: ContactObj | null
private dirtyObj: ContactObj | null
// private dirtyObj: ContactObj | null
private rawObj: ContactRawObj
/**
......@@ -564,11 +564,6 @@ export class Contact implements Sayable {
return !!(this.obj && this.obj.id && this.obj.name)
}
// public refresh() {
// log.warn('Contact', 'refresh() DEPRECATED. use reload() instead.')
// return this.reload()
// }
/**
* Force reload data for Contact
*
......@@ -577,9 +572,10 @@ export class Contact implements Sayable {
* await contact.refresh()
*/
public async refresh(): Promise<this> {
if (this.isReady()) {
this.dirtyObj = this.obj
}
// TODO: make sure the contact.* works when we are refreshing the data
// if (this.isReady()) {
// this.dirtyObj = this.obj
// }
this.obj = null
return this.ready()
}
......
......@@ -253,12 +253,17 @@ export class Io {
const payload = ioEvent.payload
if (payload.onMessage) {
const script = payload.script
/* tslint:disable:no-eval */
const fn = eval(script)
if (typeof fn === 'function') {
this.onMessage = fn
} else {
log.warn('Io', 'server pushed function is invalid')
try {
/* tslint:disable:no-eval */
const fn = eval(script)
if (typeof fn === 'function') {
this.onMessage = fn
} else {
log.warn('Io', 'server pushed function is invalid')
}
} catch (e) {
log.warn('Io', 'server pushed function exception: %s', e)
this.options.wechaty.emit('error', e)
}
}
break
......@@ -421,8 +426,11 @@ export class Io {
* Prepare to be overwriten by server setting
*
*/
private ioMessage(m) {
private async ioMessage(m): Promise<void> {
log.silly('Io', 'ioMessage() is a nop function before be overwriten from cloud')
if (typeof this.onMessage === 'function') {
await this.onMessage(m)
}
}
}
......
......@@ -844,7 +844,7 @@ export class Room extends EventEmitter implements Sayable {
.catch(e => {
log.verbose('Room', 'findAll() rejected: %s', e.message)
Raven.captureException(e)
return [] // fail safe
return [] as Room[] // fail safe
})
await Promise.all(roomList.map(room => room.ready()))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册