A personal assistant provide several customize convinient service.
- Python 3.6
- Pipenv
- 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
📝 Provided Services:
-
Weather report
👉 kaohsiung, tainan, taichung
-
TRA schedule
👉 kaohsiung, tainan, taichung, taipei, hsinchu, jiayi, taoyuan
-
PTT
👉 Baseball, Beauty
- Check hot post
- Get image
🔔 initial state is in idle
🔔 all input is case insensitive
🔔 you can type prev
back to previous state in any case
🔔 you can type sleep
force jarvis to idle
in any case
-
idle
- input
jarvis
- enter state
active
- enter state
- input
-
active
- input
ptt
- enter state
ptt
- enter state
- input
weather
- enter state
weather
- enter state
- input
train
- enter state
train
- enter state
- input
-
ptt
- input
beauty
- enter state
beauty
- enter state
- input
baseball
- enter state
baseball
- enter state
- input
-
baseball
- feature: show some recommended topic
- input: index of topic you want to know more (range is differ in different situation, but start from zero)
- next state:
bchoose
-
bchoose
- feature: get the link of topic you choose
- input: none
- next state:
idle
-
beauty
- feature: choose the mode you want to enter
- input:
popular
(only support one mode now) - next state:
popular
-
popular
- feature: enter popular mode and start to acquire image
- input:
next
ornp
- next state:
next
ornp
-
next
- feature: show next picture in same topic
- next state:
popular
-
np
- feature: show next picture in next topic
- next state:
popular
-
train
- feature: enter your schedule
- input: {departure}{arrival} {0~23}
- last query is optional
- next state:
train_result
-
train_result
- feature: show the all possible ride you can take
- input: none
- next state:
idle
-
weather
- feature: ask for location you want to know
- input: location
- next state:
degree
-
degree
- feature: show the degree you want to know
- input: none
- next state:
idle
- search postpone time of train
- use django
- add
bus
realtime schedule
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