def get_name(user_id):
data = vk.users.get(user_ids=user_id)[0]
return "{} {}".format(data["first_name"], data["last_name"])
elif word == "hi" and event.from_chat:
vk.messages.send(
chat_id=event.chat_id,
message=f"Hi, {get_name(event.user_id)}",
random_id=0
)