Помогите найти ошибку в коде
import vk
import vk_api
import datetime
import time
from time import sleep
import random
z = random.randint(1, 99999999999)
g=''
a=''
b=''
acord=0
session1 = vk.AuthSession(access_token='')
vk_api = vk.API(session1, v=5.89)
value = vk_api.users.get(user_ids='', fields='last_seen')
check = datetime.datetime.fromtimestamp(value[0]['last_seen']['time'])
def checker():
global a
global b
global g
time = datetime.datetime.fromtimestamp(value[0]['last_seen']['time'])
if check == time and acord < 5 :
acord = acord + 1
g=''
sleep(60)
elif check == time and acord >= 5 and a != "OffLine" :
a=str("OffLine")
b=''
acord = acord + 1
g="OffLine" + " " +str(time)
print("OffLine" + " " +str(time))
sleep(60)
elif check !=time and b != "Online":
a=''
b=str("Online")
acord = 0
check = time
g="Online" + " " + str(time)
print("Online" + " " + str(time))
sleep(60)
else:
sleep(1)
g= ''
vk = vk_api.VkApi(token="")
messages = vk.method("messages.getConversations", {"offset":0, "count":20, "filter": "unread"})
if messages["count"] >= 1:
while True:
checker()
message = body.lower()
vk.method("messages.send", {"peer_id": id, "message":g , "random_id":z})
id = messages["items"][0]["last_message"]["from_id"]
body = messages["items"][0]["last_message"]["text"]