тест кулдауна
This commit is contained in:
parent
67d3de5986
commit
ba50f2c0b8
9
index.js
9
index.js
@ -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 USAGE_RESET_TIME = 24 * 60 * 60 * 1000; // Время сброса (24 часа)
|
||||||
const commandCooldowns = {}; // Хранит временные метки вызовов команд для каждого чата
|
const commandCooldowns = {}; // Хранит временные метки вызовов команд для каждого чата
|
||||||
|
|
||||||
const COOLDOWN_TIME = 10 * 60 * 1000; // 10 минут в миллисекундах
|
const COOLDOWN_TIME = 1 * 60 * 1000; // 10 минут в миллисекундах
|
||||||
const userUsage = {}; // Для хранения информации о использовании команд пользователями
|
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
|
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);
|
await bot.deleteMessage(msg.chat.id, msg.message_id);
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
if (statCooldown(msg.chat.id)) {
|
if (statCooldown(msg.chat.id)) {
|
||||||
await sendTemporaryMessage(msg.chat.id, 'Слишком частые запросы. Подождите некоторое время.', 1000);
|
console.log('cooldown for stat')
|
||||||
|
await sendTemporaryMessage(msg.chat.id, 'Слишком частые запросы. Подождите некоторое время.', 5000);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
console.log('not cooldown for stat')
|
||||||
const chatId = msg.chat.id;
|
const chatId = msg.chat.id;
|
||||||
|
|
||||||
const topUsers = getTopUsersByAverage(); // Получаем топ пользователей по среднему баллу
|
const topUsers = getTopUsersByAverage(); // Получаем топ пользователей по среднему баллу
|
||||||
@ -413,7 +414,7 @@ bot.onText(/токсзапросы/, async (msg) => {
|
|||||||
await bot.deleteMessage(msg.chat.id, msg.message_id);
|
await bot.deleteMessage(msg.chat.id, msg.message_id);
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
if (statCooldown(msg.chat.id)) {
|
if (statCooldown(msg.chat.id)) {
|
||||||
await sendTemporaryMessage(msg.chat.id, 'Слишком частые запросы. Подождите некоторое время.', 1000);
|
await sendTemporaryMessage(msg.chat.id, 'Слишком частые запросы. Подождите некоторое время.', 5000);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user