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 🙏

© 2026 – Pkg Stats / Ryan Hefner

koishi-plugin-csss

v4.1.3

Published

一个用于 Koishi 的 CS:GO / CS2 服务器状态查询插件,支持单个/批量查询、服务器列表管理,并可将结果渲染为图片

Readme

koishi-plugin-csss

npm

cs server status - 一个用于 Koishi 的 CS1.6 / CSS / CS:GO / CS2 服务器状态查询插件,支持单个/批量查询、服务器列表管理,并可将结果渲染为图片。

功能

  • 单个/批量服务器查询:查询指定/多个IP的 CS 服务器信息,支持从数据库读取预设列表或临时输入(基于gamedig)。
  • 服务器列表管理:在数据库中添加、移除、查看和清空常用服务器地址。
  • 图片渲染:将查询结果生成为游戏风格的图片横幅(基于 Puppeteer)。

依赖插件

本插件强依赖以下插件,请确保它们已安装并启用:

命令列表

cs <address:string> - 查询单个服务器

查询指定地址的 CS 服务器状态。

别名查询server

选项

  • -i, --image:强制生成图片横幅(即使配置中关闭了图片生成)。

  • -t, --text:强制输出文本格式(即使配置中开启了图片生成)。

  • -c, --clear:清除插件运行时的内存缓存。

用法

cs 127.0.0.1:27015
cs edgebug.cn
cs [::1]:27015 -i

cs.status - 检查插件状态

显示插件当前运行状态、缓存数量和依赖可用性。

用法

cs.status

cs.help - 查看帮助信息

显示本插件的命令帮助。

csss [...addresses] - 批量查询服务器

批量查询多个服务器。如果不指定地址,将查询数据库中存储的服务器列表。

别名批量查询

选项

  • -l, --list:显示数据库中保存的服务器列表。

  • -a <address>, --add <address>:添加一个服务器到数据库列表。

  • -r <index>, --remove <index>:从数据库列表中移除指定序号的服务器。

  • -c, --clear:清空数据库中的服务器列表。

  • -i, --image:强制生成图片横幅。

  • -t, --text:强制输出文本格式。

用法

# 查询数据库中的所有服务器
csss

# 临时查询指定的几个服务器
csss 192.168.1.1:27015 game.example.com:27016

# 管理数据库列表
csss -l                         #显示数据库中保存的服务器列表
csss -a 127.0.0.1:27015         #将127.0.0.1:27015添加到数据库列表
csss -r 1                       #从数据库列表中移除序号为1的服务器
csss -c                         #清空数据库中的服务器列表

批量查询最多支持 10 个服务器,超出时仅查询前 10 个并给出提示。

自定义样式指南

koishi-plugin-csss 支持通过 customHTMLcustomBatchHTML 配置项自定义服务器状态图片的 HTML 结构和样式,从而打造符合自己风格的展示效果。本指南将说明可用的 HTML 结构、类名和修改示例。

1. 单个服务器查询模板 (customHTML)

当用户执行 cs <地址> 命令并生成图片时,插件会使用此模板渲染 HTML。

| 占位符 | 说明 | 示例值 | |--------|------|--------| | {{SERVER_NAME}} | 服务器名称(过滤特殊字符) | HNS \| 身法躲猫猫 | | {{MAP}} | 当前地图名称 | hns_bbcity | | {{PLAYERS_COUNT}} | 当前玩家人数 | 4 | | {{MAX_PLAYERS}} | 服务器最大玩家数 | 20 | | {{BOT_COUNT}} | Bot 数量 | 2 | | {{PING}} | 服务器延迟(毫秒) | 35 | | {{HOST}} | 服务器 IP 或域名 | 127.0.0.1 | | {{PORT}} | 端口号 | 27015 | | {{PLAYERS_LIST}} | 玩家列表 HTML(自动生成,见下方说明) | - | | {{TIMESTAMP}} | 当前查询时间(本地化格式) | 2026/4/21 23:30:25 |

{{PLAYERS_LIST}} 生成的结构

无玩家时:

<div class="player-row"">服务器当前无玩家在线</div>

有玩家时(玩家数超过 10 人会自动分为两列显示,通过 display: flex 布局):

<div class="player-row">Player1</div>
<div class="player-row">Player2</div>
<!-- 超过 maxPlayers 时追加 -->
<div class="player-row">... 还有 N 位玩家未显示</div>

2. 批量查询模板 (customBatchHTML)

当用户执行 csss 命令(不带地址参数,查询数据库列表)并生成图片时使用。

| 占位符 | 说明 | 示例值 | |--------|------|--------| | {{TOTAL}} | 查询的服务器总数 | 5 | | {{SUCCESSFUL}} | 成功查询的服务器数量 | 3 | | {{QUERY_TIME}} | 批量查询总耗时(格式化) | 1.2秒 或 350ms | | {{SERVERS_LIST}} | 服务器列表 HTML(自动生成,见下方说明) | - | | {{TIMESTAMP}} | 当前查询时间(本地化格式) | 2026/4/21 23:30:25 |

{{SERVERS_LIST}} 生成的结构

每个服务器会生成如下 HTML(成功时):

<div class="server-item">
  <div class="server-header">
    <span class="server-index">1.</span>
    <span class="server-name">HNS | 身法躲猫猫</span>
    <span class="server-players">4/20</span>
  </div>
  <div class="server-details">
    <span class="server-addr">127.0.0.1:27015</span>
  </div>
  <div class="server-details">
    <span class="server-map">地图: hns_bbcity</span>
    <span class="server-ping">延迟: 35ms</span>
  </div>
</div>

查询失败时:

<div class="server-item error">
  <div class="server-header">
    <span class="server-index">2.</span>
    <span class="server-name">127.0.0.1:27015</span>
    <span class="server-status">❌ 查询失败</span>
  </div>
  <div class="server-details error-msg">连接超时</div>
</div>

默认HTML模板结构参考

单个服务器查询 (cs)

<body>
  <div class="corner corner-tl"></div>
  <div class="corner corner-tr"></div>
  <div class="corner corner-bl"></div>
  <div class="corner corner-br"></div>
  
  <div class="title">[服务器状态查询]</div>
  <div class="server-name">服务器名称</div>
  <div class="divider"></div>
  
  <div class="info-row">
    <span>地图: de_dust2</span>
    <span>IP: 127.0.0.1:27015</span>
  </div>
  <div class="info-row">
    <span style="color: #4CAF50;">人数: 12/32</span>
    <span style="color: #4CAF50;">Ping: 45ms</span>
  </div>
  
  <div class="player-section">
    <div class="player-section-title">在线玩家</div>
    <div class="divider" style="margin: 5px 0 15px;"></div>
    <!-- 玩家列表 -->
    <div class="player-row">玩家名1</div>
    <div class="player-row">玩家名2</div>
    ...
  </div>
  
  <div class="timestamp">查询时间: 2024/1/1 12:00:00</div>
</body>

批量服务器查询 (csss)

<body>
  <div class="corner corner-tl"></div>
  <!-- ... 其余三角 ... -->
  <div class="title">[服务器状态批量查询]</div>
  <div class="stats">
    <span>查询时间: ...</span>
    <span>耗时: 2.1秒 | 成功: 3/5</span>
  </div>
  <div class="divider"></div>
  <div class="server-item">
    <div class="server-header">
      <span class="server-index">1.</span>
      <span class="server-name">服务器A</span>
      <span class="server-players" style="color: #4CAF50;">12/32</span>
    </div>
    <div class="server-details">
      <span class="server-addr">127.0.0.1:27015</span>
      <span class="server-ping" style="color: #4CAF50;">延迟: 45ms</span>
    </div>
    <div class="server-details">
      <span class="server-map">地图: de_dust2</span>
    </div>
  </div>
  <!-- 失败条目 -->
  <div class="server-item error">
    <div class="server-header">
      <span class="server-index">2.</span>
      <span class="server-name">192.168.1.1:27016</span>
      <span class="server-status">❌ 查询失败</span>
    </div>
    <div class="server-details error-msg">连接超时</div>
  </div>
  <div class="timestamp">📋 输入 `cs 服务器地址` 查询单个服务器</div>
</body>

注意事项

  • 使用!important:默认样式通常带有较高优先级,自定义时建议加!important确保覆盖。

  • 字体支持:请确保运行环境已安装您指定的字体,否则将回退到默认等宽字体。

  • 图片尺寸:imageWidthimageHeight 在配置中设定,但可通过 CSS 覆盖 bodywidthmin-height