How to Run

In order to run Maid-chan properly, you need to be able to use Facebook Messenger Bot.

Maid-chan Installation

  1. Clone the code from Github.
$ git clone https://github.com/freedomofkeima/messenger-maid-chan.git
  1. You need to fill Facebook token information in maidchan/config.py based on maidchan/config.py.example.
# Facebook token
ACCESS_TOKEN = "FACEBOOK_PAGE_ACCESS_TOKEN"
VERIFY_TOKEN = "WEBHOOK_VERIFY_TOKEN"  # Set this value by yourself

# Optional (recipient_id)
ADMIN = [
    "123...9"
]

# Chatbot storage
STORAGE_ADAPTER = "chatterbot.storage.MongoDatabaseAdapter"
IS_CHATTERBOT_ENABLED = True

ACCESS_TOKEN is received when you are creating an application on Facebook.

VERIFY_TOKEN should be your secret token between Facebook and your application.

ADMIN is recipient_id of application’s admin. The only way to get this value is from communicating directly with your application, since recipient_id is not the same with user’s Facebook ID and it differs between applications.

STORAGE_ADAPTER is used to store Chatterbot learning data. By default, it will use SQLite as its default storage adapter. See Chatterbot Documentation or Storage Adapter for better reference.

3. Maid-chan is using Redis as the database. Redis can be downloaded via https://redis.io/download. It’s preferable to run Redis as a background process in port 6379 (default port).

$ screen -R redis # use screen
$ ... # run Redis in background

4. ChatterBot 0.8.X has dropped support for simple JSON storage because of performance issues. Depending on your choice, you need to have either SQLite or MongoDB and modify maidchan/config.py accordingly. Alternatively, you can set IS_CHATTERBOT_ENABLED flag to False in maidchan/config.py to disable chatbot feature.

5. It is recommended to use virtualenv for running Python code. After that, you need to install all dependencies which are specified in requirements.txt.

$ python3 -m venv venv # create virtualenv
$ source venv/bin/activate # start virtualenv
$ pip install -r requirements.txt # install Maid-chan dependencies
  1. Finally, you can create Maid-chan executables by executing:
$ python setup.py install
$ maidchan # start Maid-chan main logic

Maid-chan Executables

Maid-chan has 3 executables (recommended to use screen):