# words-per-day

> wechaty每日一句插件

Latest version **0.0.22** (published 2020-09-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install words-per-day
pnpm add words-per-day
yarn add words-per-day
bun add words-per-day
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; large bundle; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.22 |
| Published | 2020-09-26 |
| First published | 2020-07-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 12.3 MB |
| Known vulnerabilities | 0 (+27 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 7 |
| Author | univerone |
| Maintainers | univerone |

## Links

- npm: https://www.npmjs.com/package/words-per-day
- Repository: https://github.com/univerone/words-per-day
- Homepage: https://github.com/univerone/words-per-day#readme
- Issues: https://github.com/univerone/words-per-day/issues
- npm.io page: https://npm.io/package/words-per-day

## Dependencies (11)

- [gm](https://npm.io/package/gm.md) ^1.23.1
- [axios](https://npm.io/package/axios.md) ^0.20.0
- [cheerio](https://npm.io/package/cheerio.md) ^1.0.0-rc.3
- [wechaty](https://npm.io/package/wechaty.md) ^0.48.8
- [puppeteer](https://npm.io/package/puppeteer.md) ^5.3.1
- [git-scripts](https://npm.io/package/git-scripts.md) ^0.4.3
- [memory-card](https://npm.io/package/memory-card.md) ^0.10.1
- [jsonpath-plus](https://npm.io/package/jsonpath-plus.md) ^4.0.0
- [node-schedule](https://npm.io/package/node-schedule.md) ^1.3.2
- [qrcode-terminal](https://npm.io/package/qrcode-terminal.md) ^0.12.0
- [wechaty-plugin-contrib](https://npm.io/package/wechaty-plugin-contrib.md) ^0.14.15

## Recent versions

- 0.0.22 (latest) — 2020-09-26
- 0.0.21 — 2020-09-26
- 0.0.20 — 2020-09-26
- 0.0.19 — 2020-09-26
- 0.0.16 — 2020-09-26
- 0.0.15 — 2020-09-16
- 0.0.14 — 2020-09-01
- 0.0.13 — 2020-08-18
- 0.0.12 — 2020-08-13
- 0.0.11 — 2020-08-13
- 0.0.10 — 2020-08-13
- 0.0.9 — 2020-08-09
- 0.0.8 — 2020-08-09
- 0.0.7 — 2020-08-04
- 0.0.6 — 2020-08-03
- … 5 more at https://npm.io/package/words-per-day/versions

## README

# Words per Day-wechaty 每日一句插件

![logo](docs/images/logo.png)

## 1. 安装使用

```javascript
const { Wechaty, log} = require("wechaty");
const { WordsPerDay} = require("words-per-day");
const bot = new Wechaty();
bot
  .use(WordsPerDay(/*config*/))
  .on("login", (user) => log.info("Bot", `${user.name()} logined`))
  .on("logout", (user) => log.info("Bot", `${user.name()} logouted`))
  .on("error", (e) => log.info("Bot", "error: %s", e));
bot.start();
```

## 2. 自定义数据来源

可以自定义获取数据来源的函数，函数的类型如下：

```javascript
export interface getWordsFunc {
  (): Promise<string>;
}
```

jsonpath的语法可参考：

* <https://www.npmjs.com/package/JSONPath>
* <https://jsonpath.com/>

```javascript
async function getDailyEnglish(){
    return getWords(
        Theme.JSON,
        'https://apiv3.shanbay.com/weapps/dailyquote/quote/',
        ['content', 'translation']
    );
}

const config = {
  rooms: ["打卡群"],// 作用每日一句的群名列表
  sendTime: "13:02",// 自动发送每日一句的时间
  trigger: "打卡",// 群内触发每日一句生成图片的关键词
  imageDir: 'image',//本地保存图片文件的路径
  imageStyle: 0, // 打卡图片的风格,只有0和1两种
  name: '每日英语',// 每日一句数据源的名称
  func: getDailyEnglish // 每日一句数据源的函数名
};
```

## 3.效果截图

### 1. 定时发送信息

![screenshot1](docs/images/screenshot1.png)

### 2. 根据关键词回复打卡图片

打卡图片的生成

#### 2.1 风格1

每次生成的打卡图片颜色不同
![screenshot2](docs/images/screenshot2.png)

打卡图片的具体样式如下，显示打卡用户的头像和名字
![screenshot3](docs/images/screenshot3.png)

#### 2.2  风格2

![screenshot4](docs/images/screenshot4.png)

打卡图片的具体样式如下
![screenshot5](docs/images/screenshot5.png)

---
_Source: https://npm.io/package/words-per-day · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
