Dota 2 Facebook Messenger
Dota 2 Facebook Webhooks - Simple query for players information via Facebook messenger.
- messages
- messaging_postbacks
- pages_messaging
- pages_messaging_phone_number
- pages_messaging_subscriptions
- Python 3 (tested in 3.5.2)
- Eve 0.6.4 (include Flask 0.10.1)
- dota2api 1.3.2
- SQLAlchemy 1.1.4
- Flask-SQLAlchemy 2.1
- mysql-connector 2.1.4 (Required for mysqld server, but for other database adapters please read more in this document)
- requests 2.12.1
- virtualenv 15.1.0
- pip 9.0.1
- gunicorn 19.6.0 (Required and recommended for nginx web server)
- supervisor 3.3.1
- MySQL 5.7 (tested in 5.7.16)
- Masters
- heroes: Dota2 Heroes
- items: Dota2 Items
- Details
- match_heroes: Dota2 player matchs with selected hero
- match_items: Dota2 player matchs with the last used items
- Analytics
- match_summaries: Dota2 player statistic
- match_hero_summaries: Dota2 player heroes statistic
- match_item_summaries: Dota2 player items statistic
- Config
- histories: Records the latest matchs that been processed
File: config.py
- D2_API_KEY: Get one from Valve.
- CONNECT_STRING: Setup the DBAPI support (example: mysqld)
- APP_SECRET: Facebook App Secret can be retrieved from the App Dashboard
- PAGE_ACCESS_TOKEN: Get a Page Access Token
- VALIDATION_TOKEN: A secured random string for Facebook Webhooks GET validation.
File: middleware.py
- initialize_database(): Creates and checks all the tables in targeted database.
- fill_database_master(): Creates or updates Heroes and Items records.
- fill_database_detail(): Records the next 100 matches since the last match id that been processed and do a analytic to summarize the players statistics.
Note: Dota2 data will be queried from dota2api package.
python middleware.py
- Search function will requires for the players table to be optimized by full-text search.
- Schedulers need to be setup out of this code to re-trigger the fill_database_master() and fill_database_detail() methods.
- Analytics process need to be improves or re-engineering to use a better solutions to avoid any dirty data because of unexpected errors been raised by the system.
There will be no data from Facebook Messenger that gonna be recorded inside these application.