Expired keys support

This commit is contained in:
Profitroll 2022-09-15 13:50:14 +02:00
parent e9d083c156
commit 6f8d7c2759
4 changed files with 6 additions and 0 deletions

3
bot.py
View File

@ -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))

View File

@ -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"

View File

@ -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."

View File

@ -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, якщо хочете."