A WeChat bot powered by WeChaty.
All operations of Sunbot is based on command call. You just need to send simple command in the chat window of WeChat/WhatsApp to the bot, and it will reply to you automatically.
-
ding-dong bot: Send
ding
to the bot in wherever room or private talk. If the bot running normally, it will reply youdong
. -
repeater: If 4 consecutive identical text messages are detected in the current room chat, the message will be automatically repeated.
-
(Unstable) Cats' and Dogs' photo: Send
发猫猫
or发狗狗
to the bot and it will reply you the cats' or dogs' photo. -
Status page:
After bot starts normally, it will automatically start the status page, which listens at http://localhost:4721 by default. You can change the default port in the configuration.
"statusPage": { "enable": true, "port": 4721 },
Sunbot js-version
branch, more interesting and fun features, such as Wordle, 1A2B game and wordcloud.
Wechaty University Admission Helper, published on the official blog of wechaty https://wechaty.js.org/2022/09/27/wechaty-university-admission-helper/
-
Rename
config/config-example.json
toconfig/config.json
. Modify the configuration file according to your actual situation.bot.puppet
is what puppet you are using. For more details, see Wechaty Puppet Providers.bot.puppetOptions.token
is your puppet token. If your puppet don't need token, you needn't change it.Note: You may need to run
npm install YOUR_PUPPET_HERE
according to your puppet. For example, runnpm install wechaty-puppet-padlocal
before you get to the next step. -
(Optional) If you need to use some database-based plugins, you need to install mysql client and mysql server.
The following plugins are implemented based on the database:
repeater(optional)
Modify the
database
settings in the configuration file. If you keep the default configuration, then you need to execute the following commands. Otherwise, modify the command according to your configuration before executing it.$ mysql -u root -p -- Enter your password for root -- The following command will be run in mysql client CREATE DATABASE `sunbot`; CREATE USER `sun` IDENTIFIED BY '123456'; GRANT ALL ON `sunbot`.* TO `sun`; EXIT;
-
Run
$ npm install $ npm run start
By the way, you can set whether to enable each plugin in the configuration.
"plugins": {
"dingdong": {
"enable": true
},
"repeater": {
"enable": true
},
"cats": {
"enable": true
},
"dogs": {
"enable": true
}
}
$ npm run build
The built file will generate into folder dist
.
Run the following command, which supports real-time compilation and operation.
$ npm run dev
Run the following command, which supports performs TypeScript code inspection with ESLint
and auto-formatting code with prettier
.
$ npm run check
Code formatting and inspection will be performed automatically every time you commit, and the commit will not be allowed if the inspection fails.
In order to make the commit more standardized (git-emoji-commit), please use the following command to commit:
$ npm run check && git add . && npm run commit
The following NPM packages are used by this project.
wechaty
wechaty-puppet-*
typescript
ts-node
express
@types/express
jsdom
@types/jsdom
mysql2
@types/mysql
GNU General Public License v3.0