If you want to be rich, you need to be accountable for your money first.
It's an user friendly linebot based on finite state machine.
Its goal is to help you to track your money easily.
Hence, it got lots of buttons to stop you from tiredly typing your transaction information.
Line id : @275yfsdf
Click 查詢
to ckeck your transaction history, or click 記帳
to record a new transaction.
When you click 記帳
, it'll show you a menu for you to choose which kind of transaction you want to record (expense or income).
Next, you can choose a specific type of your transaction, 食、衣、住、行、育、樂
in expense, 薪資、獎金、投資、零用錢
in income.
Then type in the transaction value and some description.
When you click 查詢
, it'll show you a menu to pick which kind of history you want to look.
There are three types of history you can look up, which are single day, this week, and this month.
If you choose single day, it'll show you a menu for you to pick which day's information you want to look up.
If you choose to see week or month information, there are 4 kinds of information you can choose.
收入結構
-> It'll show you a pie chart of income structure.
支出結構
-> It'll show you a pie chart of expense structure.
收支比例
-> It'll show you a pie chart of ratio of expense and income.
各項金額
-> It'll show you a bar chart of every kind of transaction.
- Python 3.6
- Pipenv
- Facebook Page and App
- HTTPS Server
pip3 install pipenv
pipenv --three
pipenv install
pipenv shell
- pygraphviz (For visualizing Finite State Machine)
You should generate a .env
file to set Environment Variables refer to our .env.sample
.
LINE_CHANNEL_SECRET
and LINE_CHANNEL_ACCESS_TOKEN
MUST be set to proper values.
Otherwise, you might not be able to run your code.
You can either setup https server or using ngrok
as a proxy.
or you can use Homebrew (MAC)
brew cask install ngrok
ngrok
would be used in the following instruction
ngrok http 8000
After that, ngrok
would generate a https URL.
python3 app.py
Or You can use servo to expose local servers to the internet.
The initial state is set to user
.
Every time user
state is triggered to advance
to another state, it will go_back
to user
state after the bot replies corresponding message.
- user
-
Input: "go to state1"
- Reply: "I'm entering state1"
-
Input: "go to state2"
- Reply: "I'm entering state2"
-
Setting to deploy webhooks on Heroku.
or you can use Homebrew (MAC)
brew tap heroku/brew && brew install heroku
or you can use Snap (Ubuntu 16+)
sudo snap install --classic heroku
-
Register Heroku: https://signup.heroku.com
-
Create Heroku project from website
-
CLI Login
heroku login
-
Add local project to Heroku project
heroku git:remote -a {HEROKU_APP_NAME}
-
Upload project
git add . git commit -m "Add code" git push -f heroku master
-
Set Environment - Line Messaging API Secret Keys
heroku config:set LINE_CHANNEL_SECRET=your_line_channel_secret heroku config:set LINE_CHANNEL_ACCESS_TOKEN=your_line_channel_access_token
-
Your Project is now running on Heroku!
url:
{HEROKU_APP_NAME}.herokuapp.com/callback
debug command:
heroku logs --tail --app {HEROKU_APP_NAME}
-
If fail with
pygraphviz
install errorsrun commands below can solve the problems
heroku buildpacks:set heroku/python heroku buildpacks:add --index 1 heroku-community/apt
refference: https://hackmd.io/@ccw/B1Xw7E8kN?type=view#Q2-如何在-Heroku-使用-pygraphviz
TOC-Project-2019 ❤️ @winonecheng
Flask Architecture ❤️ @Sirius207