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 += ("{first_name} ({nickname} {tag})\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, "Ничего не найдено!")