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

v2.2.0

Published

MediaWiki for koishijs

Downloads

130

Readme

MediaWiki for koishi.js

Koishi.js 的 MediaWiki 插件,将您的群聊与 wiki 站点紧密连接!

如何安装

SDK 玩家(推荐)

作者平时都这么玩,一般会确保这个方法是可用的

Add the package:

# Using pnpm
pnpm add koishi-plugin-mediawiki
# Yarn? Sure.
yarn add koishi-plugin-mediawiki
# Or just npm
npm i koishi-plugin-mediawiki

Then in your entry file:

// Import the plugin
import PluginMediawiki from 'koishi-plugin-mediawiki'
// the `app` is koishi App instance
app.plugin(PluginMediawiki, {
  // configs here...
})

CLI 玩家(也还行,就是配置自定义信息框的时候会很抽象)

koishi.yml

plugins:
  mediawiki:
    # configs here...

控制台玩家(我不好说,大概兼容吧……)

在插件中心搜索koishi-plugin-mediawiki

特色功能

您正在经营 MediaWiki 网站的附属群聊?为您的 koishi 机器人添加“wiki”指令吧,实用 wiki 功能一网打尽!

便捷绑定

一键配置 wiki 与群组连接,无需写死在配置文件

页面链接及详情

自动识别消息里的 wiki 链接,兼容中文简繁转换,此外还可以输出页面摘要(为防止刷屏预设关闭)

还能正确处理锚点

处理特殊页面,防止暴露敏感信息

即使页面不存在也不会爆炸

以及其他超酷的功能

  • 搜索 wiki,并给出前几个匹配项的摘要
  • 请求条目不存在时,自动使用关键字进行搜索(预设关闭)
  • 发送条目的信息框(Infobox)截图(内置萌娘百科、灰机、Fandom 支持,其他 wiki 可能需要自行配置,见下方说明)

都看到这了,快去安装吧

配置选项

interface Config {
  // 指令用户权限
  cmdAuthWiki: number // 1
  cmdAuthConnect: number // 2
  cmdAuthSearch: number // 1
  // 页面不存在时自动搜索(预设关闭)
  searchIfNotExist: boolean
  // wiki 指令附带页面摘要(预设关闭)
  showDetailsByDefault: boolean
  // 额外信息框配置
  customInfoboxes: InfoboxDefinition[]
}

自定义信息框配置

SDK 玩家(推荐)

// 举个例子
app.plugin(PluginMediawiki, {
  customInfoboxes: [
    {
      // URL匹配规则
      match: (url: URL) => url.host.endsWith('fandom.com'),
      // infobox 选择器列表
      selector: ['.mw-parser-output aside.portable-infobox'],
      // 额外 css
      injectStyles: '.foo { display: none } .bar { display: block }',
    },
  ],
})

CLI/控制台玩家

写正则表达式的时候得小心点,它真的很抽象,但是我确实没有更好的办法兼容它了

plugins:
  plugins:
    mediawiki:
      # URL匹配规则,一个正则表达式字符串
      match: '^https?:\/\/.+?\.fandom\.com'
      # infobox 选择器列表
      selector:
        - '.mw-parser-output aside.portable-infobox'
      # 额外 css
      injectStyles: |
        .foo { display: none }
        .bar { display: block }

系统需求

  • koishi 主程序版本 ^4.16.0
  • 需要数据库支持 koishi-database-*
  • 截图功能需要 koishi-plugin-puppeteer

Copyright 2021 Dragon-Fish

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0