telegram_libs 0.1.28__py3-none-any.whl → 0.1.29__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- telegram_libs/locales/en.json +3 -0
- telegram_libs/locales/ru.json +3 -0
- telegram_libs/utils.py +8 -0
- {telegram_libs-0.1.28.dist-info → telegram_libs-0.1.29.dist-info}/METADATA +1 -1
- {telegram_libs-0.1.28.dist-info → telegram_libs-0.1.29.dist-info}/RECORD +7 -7
- {telegram_libs-0.1.28.dist-info → telegram_libs-0.1.29.dist-info}/LICENSE +0 -0
- {telegram_libs-0.1.28.dist-info → telegram_libs-0.1.29.dist-info}/WHEEL +0 -0
telegram_libs/locales/en.json
CHANGED
@@ -14,5 +14,8 @@
|
|
14
14
|
"support": {
|
15
15
|
"message": "Write down any questions, issues or suggestions you have, and we will resolve them as soon as possible 👇 ",
|
16
16
|
"response": "Thank you! Our support team will contact you soon."
|
17
|
+
},
|
18
|
+
"rate_limit": {
|
19
|
+
"exceeded": "You have exceeded the free rate limit for today. Please try again tomorrow."
|
17
20
|
}
|
18
21
|
}
|
telegram_libs/locales/ru.json
CHANGED
@@ -14,5 +14,8 @@
|
|
14
14
|
"support": {
|
15
15
|
"message": "Напишите любые вопросы, проблемы, или предложения и мы решим их как можно скорее 👇 ",
|
16
16
|
"response": "Спасибо! Наша служба поддержки свяжется с вами в ближайшее время."
|
17
|
+
},
|
18
|
+
"rate_limit": {
|
19
|
+
"exceeded": "Вы превысили лимит бесплатных запросов на сегодня. Пожалуйста, попробуйте снова завтра."
|
17
20
|
}
|
18
21
|
}
|
telegram_libs/utils.py
CHANGED
@@ -105,6 +105,14 @@ class RateLimitManager:
|
|
105
105
|
self.increment_action_count(user_id, user_data)
|
106
106
|
return True
|
107
107
|
return False
|
108
|
+
|
109
|
+
async def check_limit_with_response(self, update: Update, context: ContextTypes.DEFAULT_TYPE, user_id: int) -> None:
|
110
|
+
"""Check if user can perform an action and handle the response."""
|
111
|
+
if not self.check_and_increment(user_id):
|
112
|
+
lang = self.mongo_manager.get_user_info(user_id).get("lang")
|
113
|
+
message = t("rate_limit.exceeded", lang, common=True)
|
114
|
+
await update.message.reply_text(message)
|
115
|
+
await get_subscription_keyboard(update, lang)
|
108
116
|
|
109
117
|
def increment_action_count(self, user_id: int, user_data: dict = None) -> None:
|
110
118
|
"""Increment the daily action count for the user."""
|
@@ -2,16 +2,16 @@ telegram_libs/__init__.py,sha256=xrsD5r6ZiJxPapHf1UhQ61z2gHtCCWrzW0CZHvlvXRc,82
|
|
2
2
|
telegram_libs/constants.py,sha256=mATa2Pr4YzPGNrqw29kOHK7sSefWvENZ-byPPZCBTc8,958
|
3
3
|
telegram_libs/error.py,sha256=uomabeEiSP4v4AEpKYbi_gR0l3G003sio6lKl72AinY,453
|
4
4
|
telegram_libs/handlers.py,sha256=d5-4FvjyWcJeN1i3dHTYhF-2P4j7PbM1QElloFR_llg,2417
|
5
|
-
telegram_libs/locales/en.json,sha256=
|
6
|
-
telegram_libs/locales/ru.json,sha256=
|
5
|
+
telegram_libs/locales/en.json,sha256=5GT1mk1xskau1oaku0E6tZ7-aGf3F1qwkJzD_bN0uV8,960
|
6
|
+
telegram_libs/locales/ru.json,sha256=KvlxUUpwNyiOtDBhUm3U13Gj7UtzLKX5SzHOdkPT6gY,1411
|
7
7
|
telegram_libs/logger.py,sha256=oikvkZMk2kOLvQI9hVMUGMCoSnOPf_fhMvv2SbO-STo,891
|
8
8
|
telegram_libs/mongo.py,sha256=j1UIGnldvaNZaFPltCvEUcUOOCoquBWvqPh7Q2HTrvY,4776
|
9
9
|
telegram_libs/payment.py,sha256=cNb2vnBlYI_6KnTGz-PCM0uKahW2uGjHVn1mGYlYG-4,3564
|
10
10
|
telegram_libs/subscription.py,sha256=NJlh1kcDfasX1XLpkVfe1UbZslpWSC1hXHaum0kfG8A,4693
|
11
11
|
telegram_libs/support.py,sha256=a3BA7g3seVBUMasv65SzxebLayLigA069wvDcStYbCM,2748
|
12
12
|
telegram_libs/translation.py,sha256=8Kb2cgqKKZH4X_i2Le0V_K1imZdoaCzYAca831DOBig,2049
|
13
|
-
telegram_libs/utils.py,sha256
|
14
|
-
telegram_libs-0.1.
|
15
|
-
telegram_libs-0.1.
|
16
|
-
telegram_libs-0.1.
|
17
|
-
telegram_libs-0.1.
|
13
|
+
telegram_libs/utils.py,sha256=Y-WwncNugCbmzQjvDg95NEI-bHRIX9Ly6SVuySJjpjo,4698
|
14
|
+
telegram_libs-0.1.29.dist-info/LICENSE,sha256=ZXkWPZbCc61L29Gz6ZHPwn1c4Pm0TnfIqtx8jGWi9F4,1069
|
15
|
+
telegram_libs-0.1.29.dist-info/METADATA,sha256=Qi0yn7gicb9WnTwCqyF_EPSZWXCZqEt14vp5Caoi8hA,804
|
16
|
+
telegram_libs-0.1.29.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
17
|
+
telegram_libs-0.1.29.dist-info/RECORD,,
|
File without changes
|
File without changes
|