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-eula

v1.2.0

Published

EULA(End-user licence agreement) for your koishi bot.

Downloads

150

Readme

koishi-plugin-eula

npm Rating

为你的 Koishi bot 添加一个 EULA(End-user licence agreement)

普通用户直接使用

在插件市场中搜索 eula 点击添加即可。

开发扩展 eula 能力 (1.0+)

首先需要添加 eula 开发模式依赖:

# yarn:

yarn add koishi-plugin-eula -d

# or use npm

npm i koishi-plugin-eula -d

并且可以在 package.json 中加入如下 koishi 字段来声明 eula 依赖:

//package.json

...
  "koishi": {
    ...,
    "service": {
      "required": [..., "eula"]
    },
    ...
  },
...

然后,在您的插件中引入类型依赖来获得类型提示

以及添加 using 引用来让 koishi 正确的加载插件顺序:

import {} from 'koishi-plugin-eula'

export const using = ['eula', ...]

最后,在您的插件中通过 eula/update 事件来获得 eula 状态,并根据状态自行调整:

ctx.on('eula/update', (session: Session, eula: boolean) => {
    //more core
})

经过如上方式便可在您的插件中使用 eula 流程,或者基于 eula 的认证能力扩展出更多的玩法。

API

服务:eula

ctx.eula.vertify()

一般情况下,更推荐使用 eula/update 事件来获得认证状态,这将得到完整 Session 支持

验证该用户是否同意过 eula

  • userId: number 用户 id,即 session.user.id

扩展事件

事件:eula/before

命令触发 eula 流程发生该事件

事件:eula/update

当用户回复 eula 后触发,这将传入一个 eula boolean 来告知用户同意与否