facebookarchive / pyaib

An easy to use Python Framework (that uses gevent) for writing IRC Bots.
Apache License 2.0
337 stars 71 forks source link

support webhook #5

Closed zodman closed 10 years ago

zodman commented 10 years ago

can be awesome!

fried commented 10 years ago

webhook?

zodman commented 10 years ago

https://help.github.com/articles/post-receive-hooks

recive this!

vilhelmk commented 10 years ago

We've solved this by running a separate flask server and dispatching messages to the bot through a message queue (using redis). We also receive service alerts using this method, and I guess in the future we might do requests from our code-base to report on certain events (like lastfm does with their irccat).

Having a internal webserver for these things would probably make it a lot more feasible to implement.

fried commented 10 years ago

Well I don't know if adding a web framework to the pyaib dependencies is the solution here. But I think an example of how to marry to two could be in order. A helper method to construct a irc.Message like object and fire off events that plugin methods can @observe.

@vilhelmk can you gist up the example flask to catch the webhooks? (It would speed up the work to get this all integrated, since I won't have to do that step. Just worry about the pyaib pieces)

vilhelmk commented 10 years ago

@fried Sure, here it is: https://gist.github.com/vilhelmk/8958596

That's more or less exactly how we've done it (in this case we glued it with a own class that wraps redis as a message queue, and then used the every decorator to fetch messages using the same class).

zodman commented 10 years ago

Putting it on the wiki ...