This project aims to develop a chatbot to easly save information of expenses and income on Domestic Economy, althought it can be used in different approaches;
✔️ You can register your expenses (see /expenses
comand), informing a category and a subcategory (see /category
& /subcategory
comands);
✔️ You can add new cetegory & subcategory (see /add
comand);
✔️ You can register your incomes (see /income
comand);
✔️ You can retrieve a month summary of your expenses (see /summary
comand);
✔️ You can register a month summary in a graphical way of your expenses (see /plot
comand);
✔️ You can send sql query by message (see /sql
comand);
✔️ You can backup your database (see /backup
comand);
✔️ you can use it on a group chat with people yout share your expenses and incomes👫; master
branch;
✔️ you can Have this chatbot deploy in pythonanywherer with a flask webhook;
✔️ you can Have a timeseries graphs of all your expenses and incomes usingsee chatbot-functions;
- Improve UX/UI by using menus;
- Implement comando by voice by using Google API
sudo apt-get install python3-pip python3-dev python-virtualenv python3-pandas python3-matplotlib # for Python 3.n
virtualenv ZeroEuroBot -p python3
source ZeroEuroBot/bin/activate
easy_install -U pip
pip install requests
- setup.py: will create the database, tables and insert default values. :warning: Take a look on it if you plan to adequate both category and subcategories to your reality;
- dbZeroEuro.py: has all the functions related to the database: insert & retrieve data;
- economybot.py: is the bot it self. Mannage the text sent to bot and call the according functions;
- Bot_run.sh: a bash script to keep bot running even after it breaks;
- API.py: You must create this file where you should put the bot key, user-email & email password;
- Key: is needed to use the bot; Be careful to keep it save;
- user-email and email password: will be used on
/backup
function (see/backup
) to send the database backup by e-mail;
This file should be like:
API = '12312312ADAsxlclncxca'
email = '[email protected]'
password = 'your_password'
-
/start
will greeting the user, check if user is already registered in users table. If not, it will be registered inusers
table;
-
/category
will retrieve all categories already registered in thecategory
table;
e.g.:/category
-
/subcategory [category]
will show the subcategories related to a especificcategory
;
e.g.:/subcategory casa
-
/income [value]
will save the value assed as a income in the database.
⚠️ Use.
as decimal!.
e.g.:/income 1999.99
-
/expenses [value] [category] [subcategory]
will save thevalue
withcategory
andsubcategory
assigned in the database;
⚠️ Use.
as decimal!.
e.g.:/expenses 19.99 casa luz
-
/summary [param] [paramII] {month} {year}
will return the summary of data saved on database grouping byparam
. If a second param is passed (paramII
) the summary will be forcategory
andsubcategory
. Also you can optionally specify a month and year. Otherwise, the summary shown will be of the current month and year;
e.g.:/summary category subcategory 01 2018
-
/plot [param] [paramII] {month} {year}
will return a graphical (:bar_chart:) summary of data saved on database groupping byparam
.
e.g.:/plot category 01 2018
-
/backup
will create and save a database backup inbackup
folder. Also the backup file will be sent by e-mail (:warning: see API.py).
e.g.:/backup
-
/add [param] [paramII]
will create and new category or subcategory. When the command/add
is sent with param, only, the function will check ifparam
already exists as category. Otherwise, will be inserted in category table. If/add
is sent with both[param]
and[paramII]
, theparamII
will be save as subcategory with relation toparam
category.
⚠️ If intending to create a new category and subcategory, first create the category (eg.:/add newCategory
) to later save the new subcategory related to the category previusly created (e.g.:/add newCategory newSubCategory
). -
/sql
send a sql query and the results sent by message.
⚠️ commands like ALTER TABLE or DROP TABLE won't be accepted. This can be changed on economybot.py.
e.g.:/sql select * from view_general limit 3
Some links that was useful to develop this project and study python: