跳到主要内容

TypeScript Wechaty

TypeScript Wechaty

提示

TypeScript is the language that Wechaty ecosystem built on.

Quick Started

Template Repo: https://github.com/wechaty/wechaty-getting-started

1. Gitpod ❤️ Wechaty

GitPod Ready-to-Code

Use Gitpod to run our Wechaty Getting Started ding-dong BOT instantly inside your browser!

Learn more from blog post: Getting Started Without Leave Your Browser: Wechaty ❤️ Gitpod

2. Google Cloud Shell

Open in Cloud Shell

The Google Cloud Shell should open our tutorial in the right panel for you to follow and finish the tutorials easily.

Learn more from blog post: Google Cloud Shell Tutorials for Wechaty

Getting Started

Install

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
nvm install node
nvm use node

# Install build tools
sudo apt-get install build-essential

Verify

node --version
// Output: v16.16.3 (or above)
npm --version
// Output: 6.14.4 (or above)

World's shortest chatbot code

6 lines of JavaScript/TypeScript:

import { Wechaty } from 'wechaty'

Wechaty.instance()
.on('scan', (qrcode, status) => console.log(`Scan QR Code to login: ${status}\nhttps://wechaty.js.org/qrcode/${encodeURIComponent(qrcode)}`))
.on('login', user => console.log(`User ${user} logged in`))
.on('message', message => console.log(`Message: ${message}`))
bot.start()

Getting Started

Getting Started Template Repo https://github.com/wechaty/wechaty-getting-started

Maintainers

History

Docs

Badge

TypeScript Wechaty

[![TypeScript Wechaty](https://img.shields.io/badge/Wechaty-TypeScript-blue)](https://github.com/wechaty/wechaty)

Contribute

You can join our Gitter network if you aren’t already a member, read our Meeting Notes to learn what we discussed in the past, join our meeting(you are welcome!), or star & fork Wechaty GitHub repo right now!