New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

koishi-plugin-status

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koishi-plugin-status - npm Package Compare versions

Comparing version 2.0.0-beta.4 to 2.0.0-beta.5

dist/database.d.ts

12

dist/index.d.ts
import { Context, App } from 'koishi-core';
import { ActiveData } from './database';
export * from './database';
declare module 'koishi-core/dist/server' {

@@ -10,7 +12,2 @@ interface BotOptions {

}
declare module 'koishi-core/dist/database' {
interface User {
lastCall: Date;
}
}
export interface StatusOptions {

@@ -22,6 +19,4 @@ }

}
export interface Status {
export interface Status extends ActiveData {
bots: BotStatus[];
userCount: number;
groupCount: number;
memory: Rate;

@@ -48,2 +43,1 @@ cpu: Rate;

export declare function apply(ctx: Context, config: StatusOptions): void;
export {};
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.apply = exports.name = exports.StatusCode = exports.extendStatus = void 0;
const os_1 = require("os");
__exportStar(require("./database"), exports);
let usage = getCpuUsage();

@@ -98,3 +109,3 @@ let appRate;

.action(async () => {
const { bots: apps, cpu, memory, startTime, userCount, groupCount } = await getStatus(config);
const { bots: apps, cpu, memory, startTime, activeUsers, activeGroups } = await getStatus(config);
const output = apps.map(({ label, selfId, code, rate }) => {

@@ -104,11 +115,8 @@ return `${label || selfId}:${code ? '无法连接' : `工作中(${rate}/min)`}`;

output.push('==========');
output.push(`活跃用户数量:${userCount}`, `活跃群数量:${groupCount}`, `启动时间:${new Date(startTime).toLocaleString('zh-CN', { hour12: false })}`, `CPU 使用率:${(cpu.app * 100).toFixed()}% / ${(cpu.total * 100).toFixed()}%`, `内存使用率:${(memory.app * 100).toFixed()}% / ${(memory.total * 100).toFixed()}%`);
output.push(`活跃用户数量:${activeUsers}`, `活跃群数量:${activeGroups}`, `启动时间:${new Date(startTime).toLocaleString('zh-CN', { hour12: false })}`, `CPU 使用率:${(cpu.app * 100).toFixed()}% / ${(cpu.total * 100).toFixed()}%`, `内存使用率:${(memory.app * 100).toFixed()}% / ${(memory.total * 100).toFixed()}%`);
return output.join('\n');
});
async function _getStatus(config, extend) {
const [[[{ 'COUNT(*)': userCount }], [{ 'COUNT(*)': groupCount }]], bots] = await Promise.all([
app.database.query([
'SELECT COUNT(*) FROM `user` WHERE CURRENT_TIMESTAMP() - `lastCall` < 1000 * 3600 * 24',
'SELECT COUNT(*) FROM `group` WHERE `assignee`',
].join(';')),
const [data, bots] = await Promise.all([
app.database.getActiveData(),
Promise.all(app.bots.map(async (bot) => ({

@@ -123,3 +131,3 @@ selfId: bot.selfId,

const cpu = { app: appRate, total: usedRate };
const status = { bots, userCount, groupCount, memory, cpu, timestamp, startTime };
const status = { ...data, bots, memory, cpu, timestamp, startTime };
if (extend) {

@@ -126,0 +134,0 @@ await Promise.all(statusModifiers.map(modifier => modifier.call(app, status, config)));

{
"name": "koishi-plugin-status",
"description": "Show Status of Koishi",
"version": "2.0.0-beta.4",
"version": "2.0.0-beta.5",
"main": "dist/index.js",

@@ -36,3 +36,3 @@ "typings": "dist/index.d.ts",

"@types/cross-spawn": "^6.0.2",
"koishi-plugin-mysql": "^2.0.0-beta.2",
"koishi-plugin-mysql": "^2.0.0-beta.3",
"koishi-test-utils": "^4.0.0-beta.3"

@@ -42,5 +42,5 @@ },

"cross-spawn": "^7.0.3",
"koishi-core": "^2.0.0-beta.6",
"koishi-utils": "^2.1.2"
"koishi-core": "^2.0.0-beta.7",
"koishi-utils": "^2.1.3"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc