clash-telegram-bot/handlers/group/users.py

19 lines
664 B
Python
Raw Normal View History

2022-03-18 22:25:50 +03:00
from aiogram import types
from load import bot, dp
from database.worker import get_users
@dp.message_handler(is_chat=True, commands=['get'])
async def get_users_info(message: types.Message):
text = ''
users = get_users()
if users is not None:
for p in users:
text += ("<a href='tg://user?id={user_id}'>{first_name}</a> ({nickname} <code>{tag}</code>)\n").format(
user_id=p['user_id'], first_name=p['first_name'], nickname=p['nickname'], tag=p['tag']
)
await bot.send_message(message.chat.id, text)
else:
await bot.send_message(message.chat.id, "Ничего не найдено!")