Remove console.log and ignore execution limit if bot owner

This commit is contained in:
Supositware 2023-12-12 21:40:41 +01:00
parent c782708fa6
commit 0bde6afdce

View file

@ -59,36 +59,36 @@ function check(user, commandName, commands) {
} }
function addParallel(commandName) { function addParallel(commandName) {
console.log(`[ADD] Adding parallel to ${commandName}`); // console.log(`[ADD] Adding parallel to ${commandName}`);
if (!parallelLimit[commandName]) parallelLimit[commandName] = 0; if (!parallelLimit[commandName]) parallelLimit[commandName] = 0;
const prevNumber = parallelLimit[commandName]; const prevNumber = parallelLimit[commandName];
console.log(`[ADD] Previous parallel executions: ${prevNumber}`); // console.log(`[ADD] Previous parallel executions: ${prevNumber}`);
console.log(`[ADD] Current parallel executions: ${JSON.stringify(parallelLimit)}`); // console.log(`[ADD] Current parallel executions: ${JSON.stringify(parallelLimit)}`);
parallelLimit[commandName] = prevNumber + 1; parallelLimit[commandName] = prevNumber + 1;
} }
function removeParallel(commandName) { function removeParallel(commandName) {
console.log(`[REMOVE] Removing parallel to ${commandName}`); // console.log(`[REMOVE] Removing parallel to ${commandName}`);
// This shouldn't be possible // This shouldn't be possible
if (!parallelLimit[commandName]) parallelLimit[commandName] = 0; if (!parallelLimit[commandName]) parallelLimit[commandName] = 0;
const prevNumber = parallelLimit[commandName]; const prevNumber = parallelLimit[commandName];
console.log(`[REMOVE] previous number: ${prevNumber}`); // console.log(`[REMOVE] previous number: ${prevNumber}`);
console.log(`[REMOVE] previous parallel limit: ${JSON.stringify(parallelLimit)}`); // console.log(`[REMOVE] previous parallel limit: ${JSON.stringify(parallelLimit)}`);
parallelLimit[commandName] = prevNumber - 1; parallelLimit[commandName] = prevNumber - 1;
console.log(`[REMOVE] current parallel limit: ${JSON.stringify(parallelLimit)}`); // console.log(`[REMOVE] current parallel limit: ${JSON.stringify(parallelLimit)}`);
} }
function checkParallel(user, commandName, command) { function checkParallel(user, commandName, command) {
// Don't apply the rate limit to bot owner // Don't apply the rate limit to bot owner
// if (user.id === ownerId) return false; if (user.id === ownerId) return false;
console.log(`[CHECK] command limit: ${command.parallelLimit}`); // console.log(`[CHECK] command limit: ${command.parallelLimit}`);
console.log(`[CHECK] current parallel executions: ${parallelLimit[commandName]}`); // console.log(`[CHECK] current parallel executions: ${parallelLimit[commandName]}`);
if (parallelLimit[commandName] >= command.parallelLimit) { if (parallelLimit[commandName] >= command.parallelLimit) {
return 'There are currently too many parallel execution of this command, please wait before retrying.'; return 'There are currently too many parallel execution of this command, please wait before retrying.';
} }