Answer the question
In order to leave comments, you need to log in
How to add aliases for a bot in vk api?
I have my own working bot for a VK conversation, I need to make a system of nicknames so that in the future when calling commands, the bot writes the person's nickname and the answer.
example:
i:/nickname
b:enter your nickname:
i:nickname
b:your nickname - nickname
command example:
i:/time
b:nickname, time is 16:30
if "/ник" in msg:
vk_session.method('messages.send', {'chat_id':id,"message":f"@id{user_id} ({first_name}, ) " + "введи свой ник:", 'random_id' : 0})
nickname = event.object.message['text'].lower()
{user_id} == nickname
Answer the question
In order to leave comments, you need to log in
you need to create a database and store the user profile there with the parameter of his VK id and nickname, and then find his database by id. for example, the variable is called - user, and the nickname parameter is nick
@id{user_id} ({first_name}, ) write @id{user_id} ({user.nick}, )
ps you can do everything yourself, I am a coder and not a pythonist
if "/ник" in msg:
vk_session.method('messages.send', {'chat_id':id,"message":f"@id{user_id} ({user.nick}, ) " + "введи свой ник:", 'random_id' : 0})
nickname = event.object.message['text'].lower()
user.nick = nickname
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question