while True:
try:
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
if event.from_chat:
text = event["text"].split(' ')
if text[0] == "Вернуть" or text[0] == "вернуть":
s = text[1]
parts = s.rsplit('com/', 1)
res = parts[1]
print(res)
user_id1 = vk.users.get(
user_id=res
)['id']
vk.messages.addChatUser(
chat_id=event.chat_id,
user_id=user_id1,
)
except Exception as e:
print(repr(e))