npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dd-bot

v0.0.4

Published

这是一个使用 TypeScript 编写的钉钉机器人 SDK,用于发送不同类型的消息到钉钉群聊。

Downloads

3

Readme

钉钉机器人 TypeScript SDK

这是一个使用 TypeScript 编写的钉钉机器人 SDK,用于发送不同类型的消息到钉钉群聊。

声明

该仓库代码是根据 chatgpt4.0 模型生成出来的:具体对话过程:https://sharegpt.com/c/akTM0js

安装

首先,确保你已经安装了Node.jsnpm。然后,在你的项目根目录下执行以下命令来安装所需的依赖:

npm install dd-bot

用法

  1. 将上面提供的dd-bot.ts文件添加到您的项目中。
  2. 在您需要使用钉钉机器人的地方,导入DingtalkBot类并创建一个实例。

下面是一个简单的例子:

import { DingtalkBot } from 'dd-bot';

const dingtalkBot = new DingtalkBot('https://your-webhook-url');

(async () => {
  // 发送文本消息
  const textResponse = await dingtalkBot.text({ isAtAll: false }, '这是一条文本消息');
  console.log('Text response:', textResponse);

  // 发送链接消息
  const linkResponse = await dingtalkBot.link({
    text: '这个即将发布的新',
    title: '时代的火车向前开',
    picUrl: '',
    messageUrl: 'https://www.dingtalk.com',
  });
  console.log('Link response:', linkResponse);

  // 发送Markdown消息
  const markdownResponse = await dingtalkBot.markdown(
    { isAtAll: false },
    '杭州天气',
    '#### 杭州天气\n > 9度',
  );
  console.log('Markdown response:', markdownResponse);

  // 发送ActionCard消息
  const actionCardResponse = await dingtalkBot.actionCard({
    title: '乔布斯 20 年前想打造一间苹果咖啡厅,而它正是 Apple Store 的前身',
    text: '### 乔布斯 20 年前想打',
    btnOrientation: '0',
    singleTitle: '阅读全文',
    singleURL: 'https://www.dingtalk.com/',
  });
  console.log('ActionCard response:', actionCardResponse);

  // 发送FeedCard消息
  const feedCardResponse = await dingtalkBot.feedCard([
    {
      title: '时代的火车向前开1',
      messageURL: 'https://www.dingtalk.com/',
      picURL: 'https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png',
    },
    {
      title: '时代的火车向前开2',
      messageURL: 'https://www.dingtalk.com/',
      picURL: 'https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png',
    },
  ]);
  console.log('FeedCard response:', feedCardResponse);
})();

在这个例子中,我们导入了DingtalkBot类,并使用您的钉钉机器人 Webhook URL 创建了一个实例。然后,我们使用该实例发送不同类型的消息,并处理返回的响应数据。