Added baseline for sphinx documentation and on2FACode
event
The docs are still very WIP, but they should be functional. Just execute `make html` in the docs folder, and you should be able to navigate to `/docs/_build/html` and view it in your browser
This commit is contained in:
18
examples/echobot.py
Normal file
18
examples/echobot.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
from fbchat import log, Client
|
||||
|
||||
# Subclass fbchat.Client and override required methods
|
||||
class EchoBot(Client):
|
||||
def onMessage(self, mid, author_id, message, thread_id, thread_type, ts, metadata, msg):
|
||||
self.markAsDelivered(author_id, thread_id)
|
||||
self.markAsRead(author_id)
|
||||
|
||||
log.info("Message from {} in {} ({}): {}".format(author_id, thread_id, thread_type.name, message)))
|
||||
|
||||
# If you're not the author, echo
|
||||
if author_id != self.uid:
|
||||
self.sendMessage(message, thread_id=thread_id, thread_type=thread_type)
|
||||
|
||||
client = EchoBot("<email>", "<password>")
|
||||
client.listen()
|
Reference in New Issue
Block a user