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 3.0.0-beta.7 to 3.0.0-beta.8

1

dist/index.d.ts

@@ -36,2 +36,3 @@ import { Context, App, Bot, Platform } from 'koishi-core';

export declare const name = "status";
export declare const disposable = true;
export declare function apply(ctx: Context, config?: Config): void;

31

dist/index.js

@@ -30,2 +30,3 @@ var __create = Object.create;

apply: () => apply,
disposable: () => disposable,
extend: () => extend,

@@ -97,3 +98,2 @@ name: () => name

}
var startTime = Date.now();
var defaultConfig = {

@@ -114,14 +114,17 @@ path: "/status",

var name = "status";
var disposable = true;
function apply(ctx, config = {}) {
const app = ctx.app;
const all = ctx.all();
const {refresh, formatBot, format} = {...defaultConfig, ...config};
app.before("command", ({session}) => {
all.before("command", ({session}) => {
session.user["lastCall"] = new Date();
});
app.before("send", (session) => {
all.before("send", (session) => {
session.bot.counter[0] += 1;
});
let startTime;
let timer;
app.on("connect", async () => {
app.bots.forEach((bot) => {
ctx.on("connect", async () => {
startTime = Date.now();
ctx.bots.forEach((bot) => {
bot.counter = new Array(61).fill(0);

@@ -131,3 +134,3 @@ });

updateCpuUsage();
app.bots.forEach(({counter}) => {
ctx.bots.forEach(({counter}) => {
counter.unshift(0);

@@ -137,7 +140,7 @@ counter.splice(-1, 1);

}, 1e3);
if (!app.router)
if (!ctx.router)
return;
app.router.get("/status", async (ctx2) => {
ctx.router.get("/status", async (ctx2) => {
const status = await getStatus().catch((error) => {
app.logger("status").warn(error);
all.logger("status").warn(error);
return null;

@@ -152,3 +155,3 @@ });

});
app.before("disconnect", () => {
ctx.before("disconnect", () => {
clearInterval(timer);

@@ -172,5 +175,5 @@ });

async function _getStatus() {
const botList = app.bots;
const botList = all.bots;
const [data, bots] = await Promise.all([
app.database.getActiveData(),
all.database.getActiveData(),
Promise.all(botList.map(async (bot) => ({

@@ -187,3 +190,3 @@ platform: bot.platform,

const status = {...data, bots, memory, cpu, timestamp, startTime};
await Promise.all(callbacks.map((callback) => callback.call(app, status, config)));
await Promise.all(callbacks.map((callback) => callback.call(all, status, config)));
return status;

@@ -190,0 +193,0 @@ }

{
"name": "koishi-plugin-status",
"description": "Show Status of Koishi",
"version": "3.0.0-beta.7",
"version": "3.0.0-beta.8",
"main": "dist/index.js",

@@ -31,10 +31,10 @@ "typings": "dist/index.d.ts",

"peerDependencies": {
"koishi-core": "^3.0.0-beta.15",
"koishi-core": "^3.0.0-beta.16",
"koishi-utils": "^4.0.1"
},
"devDependencies": {
"koishi-plugin-mongo": "^2.0.0-beta.4",
"koishi-plugin-mysql": "^3.0.0-beta.11",
"koishi-test-utils": "^6.0.0-beta.5"
"koishi-plugin-mongo": "^2.0.0-beta.5",
"koishi-plugin-mysql": "^3.0.0-beta.12",
"koishi-test-utils": "^6.0.0-beta.6"
}
}

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