тест кулдауна

This commit is contained in:
Vufer 2024-11-10 01:34:08 +03:00
parent 67d3de5986
commit ba50f2c0b8

View File

@ -6,7 +6,7 @@ const MAX_CALLS_PER_DAY = process.env.MAX_CALLS_PER_DAY || 10; // Максима
const USAGE_RESET_TIME = 24 * 60 * 60 * 1000; // Время сброса (24 часа)
const commandCooldowns = {}; // Хранит временные метки вызовов команд для каждого чата
const COOLDOWN_TIME = 10 * 60 * 1000; // 10 минут в миллисекундах
const COOLDOWN_TIME = 1 * 60 * 1000; // 10 минут в миллисекундах
const userUsage = {}; // Для хранения информации о использовании команд пользователями
const BASE_PROMPT = `You are an advanced text analyzer that assesses messages based on several criteria. You will receive a string of text as input, and you will return the result in JSON format with the specified fields. \n
@ -386,10 +386,11 @@ bot.onText(/токстоп/, async (msg) => {
await bot.deleteMessage(msg.chat.id, msg.message_id);
} catch (error) {}
if (statCooldown(msg.chat.id)) {
await sendTemporaryMessage(msg.chat.id, 'Слишком частые запросы. Подождите некоторое время.', 1000);
console.log('cooldown for stat')
await sendTemporaryMessage(msg.chat.id, 'Слишком частые запросы. Подождите некоторое время.', 5000);
return
}
console.log('not cooldown for stat')
const chatId = msg.chat.id;
const topUsers = getTopUsersByAverage(); // Получаем топ пользователей по среднему баллу
@ -413,7 +414,7 @@ bot.onText(/токсзапросы/, async (msg) => {
await bot.deleteMessage(msg.chat.id, msg.message_id);
} catch (error) {}
if (statCooldown(msg.chat.id)) {
await sendTemporaryMessage(msg.chat.id, 'Слишком частые запросы. Подождите некоторое время.', 1000);
await sendTemporaryMessage(msg.chat.id, 'Слишком частые запросы. Подождите некоторое время.', 5000);
return
}