diff --git a/bot.py b/bot.py index 6b78b3e..07245cc 100644 --- a/bot.py +++ b/bot.py @@ -99,6 +99,9 @@ async def any_message_handler(app, msg): keys_storage[msg.text] = msg.from_user.id jsonSave(f"{data}{sep}keys_storage.json", keys_storage) logWrite(f"Added apikey {msg.text} for user {msg.from_user.id}", logs_folder=configGet("logs")) + elif msg.text in jsonLoad(configGet("expired_keys")): + logWrite(f"User {msg.from_user.id} tried to pair with expired apikey {msg.text}", logs_folder=configGet("logs")) + await msg.reply_text(locale("key_expired", "msg", locale=user_locale)) else: logWrite(f"User {msg.from_user.id} tried to pair with invalid apikey {msg.text}", logs_folder=configGet("logs")) await msg.reply_text(locale("key_wrong", "msg", locale=user_locale)) diff --git a/config.json b/config.json index 4fa6ad7..826b809 100644 --- a/config.json +++ b/config.json @@ -4,6 +4,7 @@ "api_hash": "01234567890qwertyuiop", "bot_token": "12345678:asdfghjklzxcvbnm", "api_keys": "/home/user/AutoZoomAPI/data/api_keys.json", + "expired_keys": "/home/user/AutoZoomAPI/data/expired_keys.json", "data": "data", "locales": "locale", "logs": "logs" diff --git a/locale/en.json b/locale/en.json index 6ae877d..f439cc1 100644 --- a/locale/en.json +++ b/locale/en.json @@ -6,6 +6,7 @@ "cancel_empty": "Nothing to cancel.", "key_correct": "✅ **Account successfully linked**\nYou will now receive all meetings notifications. You can also add new meetings to your AutoZoom app using /meeting command.", "key_wrong": "❌ **Personal key is incorrect**\nGet your linking key using your AutoZoom application and try again by using bot's /link command.\n\n**Need any help?**\nLearn how linking works on [our website](https://www.end-play.xyz/autozoom/bot) or contact [our support](https://support.end-play.xyz) if guide page didn't help you.", + "key_expired": "❌ **Personal key expired**\nGet new linking key using your AutoZoom application and try again by using bot's /link command.\n\n**Need any help?**\nLearn how linking works on [our website](https://www.end-play.xyz/autozoom/bot) or contact [our support](https://support.end-play.xyz) if guide page didn't help you.", "already_linked": "❌ **Account is already linked**\nIf you want to change your personal key, then you need to /unlink your account first and try to /link it once more.", "not_linked": "❌ **Account is not linked**\nYou need to /link your account to AutoZoom application first.", "unlinked": "✅ **Account successfully unlinked**\nYou can now /link it to another AutoZoom application if you want." diff --git a/locale/uk.json b/locale/uk.json index 53eb74f..2de0653 100644 --- a/locale/uk.json +++ b/locale/uk.json @@ -6,6 +6,7 @@ "cancel_empty": "Немає що відміняти.", "key_correct": "✅ **Акаунт успішно відв’язано**\nТепер ви отримуватимете сповіщення про всі зустрічі. Ви також можете додавати нові зустрічі до AutoZoom за допомогою команди /meeting.", "key_wrong": "❌ **Персональний ключ недійсний**\nОтримайте ключ зв’язування за допомогою програми AutoZoom і повторіть спробу за допомогою команди бота /link.\n\n**Потрібна допомога?**\nДізнайтесь, як працює зв’язування, на [нашому веб-сайті](https://www.end-play.xyz/autozoom/bot) або зверніться до [нашої служби підтримки](https://support.end-play.xyz), якщо сторінка посібника вам не допомогла.", + "key_expired": "❌ **Термін дії ключа закінчився**\nОтримайте новий ключ за допомогою програми AutoZoom і повторіть спробу за допомогою команди бота /link.\n\n**Потрібна допомога?**\nДізнайтесь, як працює зв’язування, на [нашому веб-сайті](https://www.end-play.xyz/autozoom/bot) або зверніться до [нашої служби підтримки](https://support.end-play.xyz), якщо сторінка посібника вам не допомогла.", "already_linked": "❌ **Акаунт вже прив’язаний**\nЯкщо ви хочете змінити свій особистий ключ, вам потрібно спочатку /unlink свій обліковий запис і спробувати /пов’язати його ще раз.", "not_linked": "❌ **Акаунт не прив’язаний**\nСпершу потрібно /link свій обліковий запис із програмою AutoZoom.", "unlinked": "✅ **Акаунт успішно прив’язано**\nТепер ви можете /link його з іншою програмою AutoZoom, якщо хочете."