Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to listen onEvent Group? #4

Open
akunzz opened this issue Oct 3, 2024 · 2 comments
Open

how to listen onEvent Group? #4

akunzz opened this issue Oct 3, 2024 · 2 comments

Comments

@akunzz
Copy link

akunzz commented Oct 3, 2024

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)

@Its-VrxxDev
Copy link
Owner

What is the error?

@akunzz
Copy link
Author

akunzz commented Nov 20, 2024

nó không nhận sự kiện onEvent như code trên tôi chạy nó không in ra được print(event_data, event_type)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants