Open akunzz opened 1 month ago
from zlapi import ZaloAPI from zlapi.models import *
imei, session_cookies = load_config()
class Bot(ZaloAPI):
def __init__(self, api_key, secret_key, imei=None, session_cookies=None): super().__init__(api_key, secret_key, imei, session_cookies) def onEvent(self, event_data, event_type): print(event_data, event_type) def onMessage(self, mid, author_id, message, message_object, thread_id, thread_type): self.markAsDelivered(mid, message_object.cliMsgId, author_id, thread_id, thread_type, message_object.msgType) print(f"{message}")
bot = Bot('api_key', 'secret_key', imei=imei, session_cookies=session_cookies) bot.listen(run_forever=True, delay=0, thread=True)
What is the error?
from zlapi import ZaloAPI from zlapi.models import *
imei, session_cookies = load_config()
class Bot(ZaloAPI):
bot = Bot('api_key', 'secret_key', imei=imei, session_cookies=session_cookies) bot.listen(run_forever=True, delay=0, thread=True)