Coder Social home page Coder Social logo

koishi-plugin-blive's Introduction

koishi-plugin-blive

npm npm-download

B 站直播订阅。在主播上下播时进行提醒。

Original plugin by Dragon-Fish [email protected]

Original repository: https://github.com/koishijs/koishi-plugin-blive

Refactored by i'DLisT [email protected] (https://idl.ist/)

安装方法

npm i koishi-plugin-blive

然后参照 安装插件 继续安装。

使用方法

使用 -help blive 可以在 bot 内查看帮助。

这个插件有 使用数据库不使用数据库 两种模式,默认使用数据库。

blive.add <id>

id: 房间号

需要 2 级权限。

新增订阅。仅在使用数据库时可用。

blive.remove <id>

id: 房间号

需要 2 级权限。

移除订阅。仅在使用数据库时可用。

blive.list [page]

page: 列表页码

显示订阅列表。

blive.search <keyword>

keyword: 关键字

搜索主播 / 直播间。

选项

--room, -r: 使用房间号进行搜索(默认行为)。此时 keyword 为房间号。

--uid, -u: 使用主播 UID 进行搜索。此时 keyword 为 UID。

--name, -n: 使用用户名进行搜索。此时 keyword 为用户名关键字,默认将显示前 10 条结果,可使用配置项更改显示条数。

可选功能

在安装了 sharp 或者 node-canvas 的情况下,这个插件会用其缩小主播头像。优先级为 sharp > node-canvas > 什么也没有装。

插件配置项

这个插件无需任何配置项即可使用,同时也提供了一些可能会用到的配置项。一些不太可能会用到的配置项就摸了。你也可以在配置时借助 JSDoc 自行查看。

配置项 默认值 说明
useDatabase true 是否使用数据库。 *1
pollInterval 60000 访问 B 站 API 的时间间隔(单位毫秒)*2
pageLimit 10 分页显示群内订阅主播时,每页的最多显示条数。
searchPageLimit 10 在使用用户名搜索主播时的最多显示条数。
maxSubsPerChannel 10 每个群 / 频道最大订阅数量。仅在使用数据库时有效。
subscriptions {} 订阅列表。仅在不使用数据库时有效。*3

*1 在没有配置数据库的情况下,即使这个选项设置为 true 也无法启用数据库。

*2 API 捅得地太频繁会被返回 429 (too many requests)。

*3 这个列表遵循以下格式:

{
  '直播间 ID 1': ['平台 1:群 1', '平台 1:群 2',...]
  '直播间 ID 2': ['平台 1:群 1', '平台 2:群 3' ...]
  ...
}

例如

{
  '117': ['onebot:114514', 'onebot:1919810']
  '3449237': ['discord:3141592653589793']
}

这个格式设计成这样是因为我懒,因为这样我就不需要手动依直播间统合一道以减少对 API 的调用了。

已知问题

因为并没有多 bot 测试环境,所以并不清楚对于多 bot 的支持如何,可能会有问题。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.