После сообщения рег в боте выводит ошибку в терминал
Traceback (most recent call last):
File "c:\Users\anton\Desktop\botvk\start.py", line 10, in
if event.obj.text.lower() == "рег":
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'lower'
import vk_api
from plugins import system, function
from vk_api.bot_longpoll import VkBotEventType, VkBotLongPoll
vk, vk_session, longpoll = system.session()
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW:
if event.obj.text.lower() == 'рег':
text = function.register(event.obj.from_id)
vk.message.send(peer_id=event.obj.peer_id,
message={text}, random_id=0)