Ограничение по Telegram user_id
This commit is contained in:
parent
b7ad7c5e47
commit
68458e0a1a
@ -1,5 +1,7 @@
|
||||
import os
|
||||
|
||||
ALLOWED_USER_IDS = os.environ.get('ALLOWED_USER_IDS', '')
|
||||
|
||||
DATABASE_USER = os.environ.get('POSTGRES_USER', 'postgres')
|
||||
DATABASE_PASSWORD = os.environ.get('POSTGRES_PASSWORD', 'postgres')
|
||||
DATABASE_HOST = os.environ.get('DATABASE_HOST', 'db')
|
||||
|
@ -560,6 +560,10 @@ async def search_callback(call: types.CallbackQuery):
|
||||
|
||||
@dp.message_handler(commands=['start'])
|
||||
async def send_welcome(msg: types.Message):
|
||||
if ALLOWED_USER_IDS:
|
||||
if str(msg.from_user.id) not in ALLOWED_USER_IDS.replace(' ','').split(','):
|
||||
await msg.reply('⛔️ Бот недоступен для Вашего аккаунта.')
|
||||
return
|
||||
user, created = await update_user_info(msg.from_user)
|
||||
tgchat, tgchat_created = await update_chat_info(msg.chat)
|
||||
if not tgchat:
|
||||
|
Loading…
x
Reference in New Issue
Block a user