spoilerвесь код
import time,random,vk_api,requests
from datetime import datetime
from colorama import init
from colorama import Fore, Back, Style
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
init()
vk_session = vk_api.VkApi(token='*************')
longpoll = VkBotLongPoll(vk_session, 183648733)
vk = vk_session.get_api()
print(Fore.GREEN+"Бот запущен!"+Fore.RESET)
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW and event.object['text']:
print(event.object.action)
if event.object.action['type'] == 'chat_kick_user':
lo = event.object.action['type']
if lo == 'None':
lo = 1
if lo == 'chat_kick_user':
si = event.object.action['member_id']
if event.from_chat:
vk.messages.removeChatUser(chat_id=event.chat_id,user_id=si)
elif event.object.action['type'] == 'chat_kick_user':
lo = event.object.action['type']
if lo == 'None':
lo = 1
if lo == 'chat_kick_user':
si = event.object.action['member_id']
if event.from_chat:
vk.messages.removeChatUser(chat_id=event.chat_id,user_id=si)
Сама ошибка
Traceback (most recent call last):
File "C:\Users\User\Desktop\спам бот\spamchik.py", line 61, in
if event.object.action['type'] == 'chat_kick_user':
TypeError: 'NoneType' object is not subscriptable
Это значение из action['type'] None