3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

feat: remove blocked-at usage

The package never really worked with Zep, causing the
entire bot to freeze instead.
This commit is contained in:
Dragory 2021-11-02 22:14:41 +02:00
parent 3f0c1496dc
commit 901a723080
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
3 changed files with 0 additions and 45 deletions

View file

@ -1,33 +0,0 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { botControlCmd } from "../types";
import blockedAt from "blocked-at";
let stop;
export const ToggleBlockDetectionCmd = botControlCmd({
trigger: ["toggle_block_detection"],
permission: "can_performance",
signature: {
threshold: ct.number({ required: false }),
},
async run({ pluginData, message: msg, args }) {
if (stop) {
stop();
stop = null;
msg.channel.send("Disabled block detection");
return;
}
const threshold = args.threshold || 1000;
const result = blockedAt(
(time, stack) => {
console.error(`Blocked for ${time}ms, operation started here:`, stack);
},
{ threshold },
);
stop = result.stop;
msg.channel.send(`Block detection enabled with ${threshold}ms threshold`);
},
});