A plugin based WhatsApp bot
A plugin based whatsapp bot
WhatsBot is one of my weekend - just for fun projects. Thanks to plugin logic, all you need is write the plugin you want and enable it right on the chat without touching the core code.
This bot uses Yowsup, a python library that enables you build application which use whatsapp service.
You might find some dirty and ugly code, feel free to make it clean and better.
VIRTUAL_ENV
in launch.sh with your virtualenv path, ex: VIRTUAL_ENV=${HOME}/.virtualenvs/whatsbot
./launch.sh install
Follow the instructions, you will be prompted to input phone number and verification code sent via sms, just follow it. Then you will get password.
./launch.sh register
data/config.json
. You need to specify database (make sure it’s prepared already). Sudo user is your number in whatsapp user_id format.
{
"bot_name": "Ellissa",
"download_dir": "/tmp/whatsbot",
"credentials" : {
"phone": "62858xxxxxxx",
"password": "xxxxxxxxxxxxxxxxx="
},
"database": {
"db_host": "localhost",
"db_user": "xxxx_user",
"db_password": "xxxxxxxxx",
"db_name": "xxxx_db"
},
"sudo_user": ["62899xxxxxxx@s.whatsapp.net"],
"plugins": ["admin"],
"contacts": {
"62899xxxxxxxxxx": "Botmaster"
}
}
./launch.sh
./launch.sh deploy
It will start automatically
sudo systemctl start whatsbot
sudo systemctl stop whatsbot
To remove from service you can run this command ./launch.sh undeploy
You can write plugin based on example
chat_data
is where your conversation done. Can be private message (chat_data = user data
), or group message (chat_data = group data
)
user_data
is data of user / sender
/plugins
/plugins enable botself
/plugins disable botself
/plugins reload
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details
If you love this project, you can buy me a cup of coffee :)