1.7.1 • Published 6 months ago
@zhengxs/ernie-wechat-bot v1.7.1
可以调用文心大模型的能力,包含文本创作、通用对话 和 AI作图,并根据内容自动调用不同的插件以丰富消息内容。
安装
# With NPM
$ npm i -S @zhengxs/ernie-wechat-bot
# With Yarn
$ yarn add @zhengxs/ernie-wechat-bot
# With PNPM
$ pnpm add @zhengxs/ernie-wechat-bot
快速开始
自带 wechat4u
,你也可以换成其他的。
import { ernieBot } from '@zhengxs/ernie-wechat-bot'
const bot = ernieBot({
// 默认从 ERNIE_BOT_COOKIE 或 EB_COOKIE 环境变量中读取
cookie: 'BDUSS=xxxxxxx;',
})
bot.listen({
name: 'ernie',
puppet: 'wechaty-puppet-wechat4u',
puppetOptions: { uos: true },
})
命令行启动
不再支持 cookie 名文传递,请使用
ERNIE_BOT_COOKIE
环境变量。
# 启动微信机器人
$ erniebot
自定义处理逻辑
import ERNIEBot, { ListenType } from '@zhengxs/ernie-wechat-bot'
const bot = new ERNIEBot({
cookie: 'BDUSS=xxxxxxx;',
})
// 自定义消息处理器
bot.on(ListenType.ImIndividualMessage, function ({ detail: message }) {
// 你的逻辑
})
// 内置个人消息处理器注册
bot.on(ListenType.ImIndividualMessage, bot.events.individual.listener())
// 内置房间消息处理器注册
bot.on(ListenType.ImRoomMentionMessage, bot.events.room.mention.listener())
bot.on(ListenType.Login, function (event) {
log.info(`🤖 ${event.detail} 上线`)
})
bot.on(ListenType.Logout, function (event) {
log.info(`🤖 ${event.detail} 离线`)
})
bot.on(ListenType.Error, function (event) {
log.error(`🤖 错误:${event.detail.message}`)
})
bot.listen({
name: 'ernie',
puppet: 'wechaty-puppet-wechat4u',
puppetOptions: { uos: true },
})
待办
- 内置插件支持
- 支持商业信息查询
- 支持说图解画插件 (
仅私聊
) - 支持览卷文档 (
仅私聊
) - 支持 TreeMind 树图
- 支持 E 言易图
- 允许聊天中动态切换插件
关联项目
感谢
以上排名不分先后.
License
MIT
1.7.1
6 months ago
1.7.0
6 months ago
1.6.3
6 months ago
1.6.2
6 months ago
1.6.1
6 months ago
1.6.0
6 months ago
1.5.1
6 months ago
1.5.0
6 months ago
1.4.2
6 months ago
1.4.1
6 months ago
1.4.0
6 months ago
1.3.0
6 months ago
1.2.0
6 months ago
1.1.0
6 months ago
1.0.2
6 months ago
1.0.1
6 months ago
1.0.0
6 months ago
0.7.2
6 months ago
0.7.1
6 months ago
0.7.0
6 months ago
0.6.0
6 months ago
0.5.0
6 months ago
0.4.0
6 months ago
0.3.0
6 months ago
0.2.2
6 months ago
0.2.1
6 months ago
0.2.0
6 months ago
0.1.0
7 months ago