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

koishi-plugin-gosen-choyen

v2.0.2

Published

Send 5000Choyen style picture via Koishi.js.

Downloads

88

Readme

koishi-plugin-gosen-choyen

npm npm-download

一个用于 Koishi v4 的生成 5000 兆円欲しい! (想要五千兆円!)风格的插件。

微调自这个 5000Choyen,图片的生成使用了 skia-canvas

效果图

图中使用的字体为思源黑体 Heavy 和思源宋体 Heavy。

安装方法

你需要安装 koishi-plugin-canvas 作为 服务 依赖。

npm i koishi-plugin-canvas koishi-plugin-gosen-choyen

然后在配置文件或入口文件中将插件添加至你的机器人中。

使用方法

5k <upper> <lower> [-x <px>] [-r]

upper:上行文字

lower:下行文字

需要两行文字的其中一行不为空才会生成图片。

| 可选选项 | 默认值 | 说明 | | - | - | - | | -x, --offset | 200 (defaultOffsetX) | 设置第二行偏移量,单位为 px | | -r, --reserve | false | 保留 CQ 码 |

插件配置项

这个插件需要配置以下配置项:

| 配置项 | 默认值 | 说明 | | - | - | - | | upper | {} | 上行文字使用的字体配置 *1 | | lower | {} | 下行文字使用的字体配置 *1 |

*1 有两种配置方式:

  1. 配置字体文件相对路径:
{
  path: './path/to/font/file'    // 字体文件相对工作目录的路径
}

或者

{
  path: 'C://path/to/font/file' // 字体文件的绝对路径
}
  1. 配置字体名字与字重:
{
  name: 'my-font',              // 字体名
  weight: 'normal'              // 字重
}

同时,也提供了一些可能会用到的可选配置项:

| 配置项 | 默认值 | 说明 | | - | - | - | | disableCQCode | false | 是否强制清除 CQ 码,true 时将覆盖 --reserve | | maxLength | 42 | 一行文字的最长文字数 | | defaultOffsetX | 200 | 第二行的默认偏移量,单位为 px,最小取 0 | | maxOffsetX | 1000 | 第二行的最大偏移量,即 --offset 的最大值,最小取 0 |

Q&A

  • 我想要某个选项(比如缩放字体)

建议git clone这个仓库然后自己拿去改一改,代码真的很简单的!

  • 发现了个 bug

这很正常。

更新记录

2.0.2

修复了某处的一个 logger 输出问题。

2.0.1

修复文档。

2.0.0

对 v4 做了一个很简陋的适配,同时从 node-canvas 迁移到了 skia-canvas。如果仍然需要用 v3 请使用 1.0 版本。

1.1.0

取消了 asSubcommand 配置项,请使用 ctx.command 进行复写以实现相同的效果。

将字体文件的配置项抽了出来,现在这个插件本身没有那么大了。

1.0.3

修了点 bug 和与预期不符的行为。

1.0.0

默认的 Koishi 版本被修改为为 Koishi v3,同时删掉了一些冗杂的日志(logger)信息。

若有需要,推荐使用 Koishi 自带的日志来进行行为的记录,例如把 command 行为的日志等级设置为 3(debug)。