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

change brand auto-reply key to wechaty/botie

上级 fcb7a692
......@@ -43,7 +43,7 @@ const bot = new Wechaty({
bot
.on('login' , user => log.info('Bot', `${user.name()} logined`))
.on('logout' , user => log.info('Bot', `${user.name()} logouted`))
.on('scan' , ({url, code}) => log.info('Bot', `[${code}] Scan QR Code in url to login: ${url}`))
.on('scan' , ({url, code}) => log.info('Bot', '[%d] %s <-- Scan QR Code in url to login', code, url))
.on('message', m => {
m.ready()
.then(onMessage)
......@@ -63,17 +63,16 @@ const onMessage = function(m) {
const content = m.toString()
const room = m.room()
log.info('Bot', '%s<%s>:%s'
, (room ? '['+room.name()+']' : '')
, from.name()
, m.toStringDigest()
)
// log.info('Bot', '%s<%s>:%s'
// , (room ? '['+room.name()+']' : '')
// , from.name()
// , m.toStringDigest()
// )
if (/^ding$/i.test(m.get('content')) && !bot.self(m)) {
bot.reply(m, 'dong')
.then(() => { log.info('Bot', 'REPLY: dong') })
if (/^wechaty|botie/i.test(m.get('content')) && !bot.self(m)) {
bot.reply(m, 'https://www.wechaty.io')
.then(_ => log.info('Bot', 'REPLIED to magic word "wechaty"'))
}
}
/**
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册