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

Synchronous functions to get the answers #8

Closed
Roby91 opened this issue Dec 24, 2023 · 2 comments
Closed

Synchronous functions to get the answers #8

Roby91 opened this issue Dec 24, 2023 · 2 comments

Comments

@Roby91
Copy link

Roby91 commented Dec 24, 2023

🚀 The feature, motivation and pitch

Hi @nicola-corbellini,

I was wondering how I should use this library to interact with the cat from outside: the "send" method looks to be asynchronous but how can I get the result of a message to be used by other services?

Let's say I want to integrate the cat with Microsoft Teams: I'd like to use this library as "man in the middle" but I can't because I can't get the answer from the "send" method.

Am I missing something?

Alternatives

No response

Additional context

No response

@nicola-corbellini
Copy link
Member

Hi @Roby91! There has recently been a refactor. Hence, with the latest version you should define a callback function like this:

def on_message(message):
    # the client will pass the message to this function

And then pass this message to the constructor

ccat = CatClient(on_message=on_message)

Sorry for the lack of documentation, we'll add more soon

@Roby91
Copy link
Author

Roby91 commented Dec 25, 2023

Great, I got it, that's enough for what I needed, thanks!

@Roby91 Roby91 closed this as completed Dec 25, 2023
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