D
D
DADDDADA2021-07-19 11:48:12
Python
DADDDADA, 2021-07-19 11:48:12

How to make the bot get the user's date of birth in VK through the Vkbottle library?

Hello! I apologize for possibly stupid questions, but nevertheless, I am a beginner in this matter and I would like to understand the topic in more detail. I would be very grateful if you send articles from Vkbottle)
I need to make sure that when a user writes to a group in VK, the bot receives his date of birth and sends it to the user. There is an option to implement this through vk_api, and in theory, if you add this to a variable, and then send it to the user through VKbottle, something might work out. But vk_api is not an asynchronous library, and is there any sense in all this? Is it possible to implement only on vkbottle?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WolfInChains, 2021-07-19
@DADDADADA

Well, in vk_api you call a specific method to get the date, what prevents you from calling the same method in vkbottle?
Something like that

from vkbottle.bot import Bot, Message

bot = Bot(BOT_TOKEN)

@bot.on.message()
async def bdate(message: Message):
    result = await message.ctx_api.users.get(user_ids=message.from_id, fields=["bdate"])
    await message.answer(f"Др: {result[0].bdate}")

bot.run_forever()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question