from aiogram import types
from aiogram.dispatcher.filters import Command
@dp.message_handler(Command('test'))
async def test(message: types.Message):
if message.reply_to_message.from_user.is_bot:
await message.answer(text='This is bot')
else:
await message.answer(text='This is user')