A telegram bot based on a finite state machine course parsing bot 利文韡 F74032162 Andrewli_bot 首先會先爬成大課程查詢的網頁(資訊系課程) 然後將資訊系的必選修分成大一大二大三大四 在依據使用者輸入去判斷要給哪個年級的資訊
- Python 3
pip install -r requirements.txt
@Andrewli_bot
API_TOKEN
and WEBHOOK_URL
in app.py 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.
ngrok
would be used in the following instruction
ngrok http 5000
After that, ngrok
would generate a https URL.
You should set WEBHOOK_URL
(in app.py) to your-https-URL/hook
.
python3 app.py
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
-
comment
- Input: 'comment'
- Reply: "推薦課程...."
- Input: 'comment'
-
parse
- Input: 'parse'
- Reply: "parsing complete"
- Input: 'parse'
-
dummy
- Input: any other string
- Reply: "command: \ncomment\nparse"
- Input: any other string
-
temp
-
grade1
- Input: "grade1"
- Reply: "result..."
- Input: "grade1"
-
grade2
- Input: "grade2"
- Reply: "result..."
- Input: "grade2"
-
grade3
- Input: "grade3"
- Reply: "result..."
- Input: "grade3"
-
grade4
- Input: "grade4"
- Reply: "result..."
- Input: "grade4"
-
dummy2
- Input: any other string
- Reply: "choose command:\ngrade1\ngrade2\ngrade3\ngrade4\n"
- Input: any other string
利文韡