S
S
szjyakgf2021-12-29 17:28:20
Python
szjyakgf, 2021-12-29 17:28:20

How to find out that I threw a replay on the bot?

I need something when I replay a user or a bot. For example, the /test command, the bot checked who it is, a bot or a user.

@dp.message_handler(commands=['test'])
async def test(message: types.Message):
    await message.reply('Это пользователь')
    await message.reply('Это бот')

What checks should be added?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
inworkl, 2021-12-29
@szjyakgf

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question