We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const { ScanStatus, WechatyBuilder, log } = require('wechaty'); const qrTerm = require('qrcode-terminal'); function onScan(qrcode, status) { if (status === ScanStatus.Waiting || status === ScanStatus.Timeout) { qrTerm.generate(qrcode, { small: true }); // show qrcode on console const qrcodeImageUrl = [ 'https://wechaty.js.org/qrcode/', encodeURIComponent(qrcode), ].join(''); log.info( 'StarterBot', 'onScan: %s(%s) - %s', ScanStatus[status], status, qrcodeImageUrl ); } else { log.info('StarterBot', 'onScan: %s(%s)', ScanStatus[status], status); } } function onLogin(user) { log.info('StarterBot', '%s login', user); } function onLogout(user) { log.info('StarterBot', '%s logout', user); } async function onMessage(msg) { log.info('StarterBot', msg.toString()); if (msg.text() === 'ding') { await msg.say('dong'); } } const bot = WechatyBuilder.build({ name: 'ding-dong-bot', puppet: 'wechaty-puppet-puppeteer', }); bot.on('scan', onScan); bot.on('login', onLogin); bot.on('logout', onLogout); bot.on('message', onMessage); bot .start() .then(() => log.info('StarterBot', 'Starter Bot Started.')) .catch(e => log.error('StarterBot', e));
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: