V
V
Vasily Volk2020-09-27 14:23:16
Python
Vasily Volk, 2020-09-27 14:23:16

How to get username of bot or user using aiogram?

Using something like this hasn't had any success

dp = Dispatcher(bot)

bot = Bot(token="#Токен бота")
async def show_info(message: types.Message):
   name = bot.get(User.full_name)
   await message.answer(text = f"{name}")

executor.start_polling(dp)

(All imports are there)
Output: None
Apologies for the stupid question. I looked in the aiogram library for something that would help me, but I did not find it.
and using
name = User.full_name Was getting
"property object at 0x0322E780" or similar results at the end
Thanks for the help)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2020-09-27
@VovkVasil

There is an answer in the description on the aiogram github
5f707c2d75764816994853.png

P
Philosophxiii, 2021-08-10
@Philosophxiii

async def json(message: types.Message):
print(message.as_json())

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question