@zhengxs/wechaty-puppet-dingtalk
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

钉钉对话机器人

结合 Wechaty,打造对话式机器人,适用于所有钉钉应用的开发者。

只支持 Node.js >= 18 的版本。

📦 安装

要安装 SDK,请运行以下命令:

# With NPM
$ npm i -S @zhengxs/wechaty-puppet-dingtalk @zhengxs/wechaty-dingtalk-message

# With YARN
$ yarn add @zhengxs/wechaty-puppet-dingtalk @zhengxs/wechaty-dingtalk-message

# With PNPM
$ pnpm install @zhengxs/wechaty-puppet-dingtalk @zhengxs/wechaty-dingtalk-message

👋 使用

创建一个 钉钉应用,并运行以下代码:

支持 企业应用第三方应用,可根据自身情况选择。

import { PuppetDingTalk } from '@zhengxs/wechaty-puppet-dingtalk';
import { WechatyBuilder } from 'wechaty';

const bot = WechatyBuilder.build({
  puppet: new PuppetDingTalk({
    clientId: process.env.DINGTALK_CLIENT_ID,
    clientSecret: process.env.DINGTALK_CLIENT_SECRET,
  }),
});

bot.on('message', async msg => {
  log.info('StarterBot', msg.toString());

  if (msg.text() === 'ding') {
    await msg.say('dong');
  }
});

bot.start();

📖 使用文档

Wiki 上阅读完整文档。

📝 License

MIT

Package Sidebar

Install

npm i @zhengxs/wechaty-puppet-dingtalk

Weekly Downloads

22

Version

0.1.1

License

MIT

Unpacked Size

122 kB

Total Files

73

Last publish

Collaborators

  • zhengxs