Get a WeChat robot 🤖 based on ChatGPT in a few step. 中文文档 | English
- Support conversation.
- Can set keywords to reset the previous conversation.
- Support replying message when mentioning your bot in the group.
- Set the keywords to wake up the WeChat robot in the group.
- Support Dockerfile to deploy.
- Support set retry times when request ChatGPT.
- Catch conversation error and retry.
- Other
{
// Fill up with session token
chatGPTSessionToken: '',
// Setting the number of retries when API error occurs
retryTimes: 3,
// Setting keyword to wake up in group chat
groupKey: '',
// Setting keyword to wake up in private chat
privateKey: '',
// Setting keyword to reset context
resetKey: 'reset',
// Enabling auto replies from ChatGPT
autoReply: true,
// Using regular expression to automatically pass friends verification
friendShipRule: /chatgpt|chat/,
}
// build
docker build --pull --rm -f "Dockerfile" -t wechatbot:latest "."
// Linux ARM
docker build --pull --rm -f "Dockerfile" -t wechatbot:latest "." --platform linux/amd64
// run, and then you will see some logs
docker run --name wechatbot wechatbot:latest
-
Firstly, you should have an OpenAI account, then follow the steps below to get your token.
Refer to this article: https://github.com/transitive-bullshit/chatgpt-api.
To get a session token:
- Go to https://chat.openai.com/chat and log in or sign up.
- Open dev tools.
- Open Application > Cookies.
- Copy the value for __Secure-next-auth.session-token and save it to your environment.
-
Now, you should fill your Token value into the
ChatGPTSessionToken
in the directorysrc/config.js
, then run this project on local.If necessary, configure other customization variables in
src/config.js
.
// install dependencies
npm i
// start:
// dev
npm run dev
//or
// build
npm run build
// run lib
node lib/bundle.esm.js
-
you can see your logs, and scan qrcode to log in wechat.
-
Send a message to your WeChat and you will receive a reply from ChatGPT.
-
If your WeChat cannot log in Please check the root directory of your project, whether there is a file ——
WechatEveryDay.memory-card
, if so, please delete it and try it again. -
This package is ESM-only. It supports: Node.js >= 16.8
-
how to get all response? you can say "continue".
Welcome to contribute your code and ideas🍵.