名称 最后更新
bin 正在载入提交数据...
conf 正在载入提交数据...
core 正在载入提交数据...
data 正在载入提交数据...
db 正在载入提交数据...
lib 正在载入提交数据...
test 正在载入提交数据...
utils 正在载入提交数据...
.gitignore 正在载入提交数据...
CHANGELOG.md 正在载入提交数据...
README.md 正在载入提交数据...
alembic.ini 正在载入提交数据...
fbchat_install.sh 正在载入提交数据...
pyinstall.sh 正在载入提交数据...
requirements.txt 正在载入提交数据...
setup.py 正在载入提交数据...

Unofficial Facebook Chat Terminal

version:v1.6.9 python:3.5+ Dev:passing Prod:passing Prod:passing

Facebook now has an official API for chat bots here.

This API is the only way to automate chat functionalities on a user account. We do this by emulating the browser. This means doing the exact same GET/POST requests and tricking Facebook into thinking we're accessing the website normally. Because we're doing it this way, this API won't work with an auth token but requires the credentials of a Facebook account.

Disclaimer: We are not responsible if your account gets banned for spammy activities such as sending lots of messages to people you don't know, sending messages very quickly, sending spammy looking URLs, logging in and out very quickly... Be responsible Facebook citizens.

See the full changelog for release details.

Install

If you just want to use facebook-chat-api, you should use this command:

cd facebookchat
python3 setup.py

Example Usage

from db.models import UserList
from lib.facebook import FacebookClient


class EchoBot(FacebookClient):
    def __init__(self,email,password):
        super().__init__(UserList(email=email,password=password))

    def onMessage(self, author_id, message_object, thread_id, thread_type, **kwargs):
        self.markAsDelivered(thread_id, message_object.uid)
        self.markAsRead(thread_id)

        log.info("{} from {} in {}".format(message_object, thread_id, thread_type.name))

        # If you're not the author, echo
        if author_id != self.uid:
            self.send(message_object, thread_id=thread_id, thread_type=thread_type)


client = EchoBot("<email>", "<password>")
client.listen()

Result:

screen shot 2016-11-04 at 14 36 00