Answer the question
In order to leave comments, you need to log in
TypeError("'Event' object is not subscriptable") how to fix?
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))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question