Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Commit

Permalink
2018-05-14
Browse files Browse the repository at this point in the history
  • Loading branch information
alstn2468 committed May 14, 2018
1 parent 2e6e92b commit 22a2d0c
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 100 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SCH Food Chatbot

[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Generic badge](https://img.shields.io/badge/Version-1.0.0-green.svg)](https://shields.io/)
[![Generic badge](https://img.shields.io/badge/Version-2.2.0-green.svg)](https://shields.io/)


## 제작자 : [김민수](https://github.com/alstn2468)<br/>Soonchunhyang University<br/>Department of Computer Software Engineering
Expand Down Expand Up @@ -113,16 +113,21 @@ Python과 Django 웹 프레임워크를 사용하여 제작한 자동 응답형

## 버전
2018/05/12<br/>
- Version [(1.0.0)](https://github.com/alstn2468/SCH_Food_ChatBot/commit/a90e974c8cbcb5274cc9d3174393c5dadf446160) released<br/>
- Version [(1.0.0)](https://github.com/alstn2468/SCH_Food_ChatBot/commit/a90e974c8cbcb5274cc9d3174393c5dadf446160) Released<br/>

2018/05/14<br/>
- Version [(2.0.0)](https://github.com/alstn2468/SCH_Food_ChatBot/commit/0345f08a672d499816ca8cf03f60ab140992656c) Update<br/>
- Version [(2.0.0)](https://github.com/alstn2468/SCH_Food_ChatBot/commit/0345f08a672d499816ca8cf03f60ab140992656c) New Function Updated<br/>
- 학사 일정 확인 기능 추가 완료

2018/05/14<br/>
- Version [(2.1.0)](https://github.com/alstn2468/SCH_Food_ChatBot/commit/ce419d7c03e235c8cc61a78d2b26d75e1f364079) Update<br/>
- Version [(2.1.0)](https://github.com/alstn2468/SCH_Food_ChatBot/commit/ce419d7c03e235c8cc61a78d2b26d75e1f364079) Food Menu Button Optimized<br/>
- 버튼 메뉴 세분화 완료

2018/05/14<br/>
- Version [(2.2.1)](https://github.com/alstn2468/SCH_Food_ChatBot/commit/ce419d7c03e235c8cc61a78d2b26d75e1f364079) New Function Updated / Source Code Modularization<br/>
- 학교 Wi-Fi 기능 추가 완료
- 소스 코드 모듈화 완료


## 친구 추가

Expand Down
26 changes: 26 additions & 0 deletions app/menu/restaurant.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"식당" : [
{"0" : "이층집 뼈다귀"},
{"1" : "궁중 화로"},
{"2" : "미스터 짱닭 치킨"},
{"3" : "중국성"},
{"4" : "모던 팩토리"},
{"5" : "장충동할머니 족발보쌈"},
{"6" : "도스마스"},
{"7" : "행복한 돈가스"},
{"8" : "토마토 도시락"},
{"9" : "불스 떡볶이"},
{"10" : "천원국수"},
{"11" : "온양왕족발보쌈"},
{"12" : "은성식당"},
{"13" : "신창족발"},
{"14" : "북경탕수육"},
{"15" : "푸짐한밥상"},
{"16" : "영식당"},
{"17" : "돼지고기김치찌개"},
{"18" : "신창상회"},
{"19" : "한솥도시락"},
{"20" : "김밥나라"},
{"20" : }
]
}
18 changes: 18 additions & 0 deletions app/my_module/button.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# views.py의 keyboard에서 사용할 버튼 모듈

basic_button = [
'학식',
'종강',
'학사 일정',
'교내 Wi-Fi',
'개발자 정보'
]

food_sel_process_button = [
'향설1 생활관',
'향설2 생활관',
'향설3 생활관',
'학생회관',
'교직원 식당',
'처음으로'
]
31 changes: 31 additions & 0 deletions app/my_module/repdic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 문자열에서 문자를 교환할 때 사용 할 딕셔너리 모듈

trans_dic = {
'[': '' ,
']': '',
'{' : '',
'}': '' ,
"'": '',
',' : '\n',
':' : '\n',
' ' : '',
'\n' : '\n·',
'-중식/석식-' : '\n[중식/석식]',
'-조식-' : '\n[조식]',
'-컵밥-' : '\n[컵밥]',
'-중식-' : '\n[중식]',
'-석식-' : '\n[석식]',
'-한식-' : '\n[한식]',
'-덮밥-' : '\n[덮밥]',
'-양식-' : '\n[양식]',
'-도시락-' : '\n[도시락]',
'-스페셜메뉴-' : '\n[스페셜메뉴]',
'-돈까스-' : '\n[돈까스]',
'-라면-' : '\n[라면]',
'-메뉴-' : '\n[메뉴]',
'-부대라면-' : '\n[부대라면]',
'-한정메뉴-' : '\n[한정메뉴]',
'-샐러드바-' : '\n[샐러드바]',
'\n·\n' : '\n\n',
'·' : '· '
}
53 changes: 53 additions & 0 deletions app/my_module/scheduleparser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 학사 일정 파싱 모듈

from pytz import timezone
from bs4 import BeautifulSoup
import requests, os, re
import json

def parser() :

# Location of parser.py
BASE_DIR = os.path.dirname(os.path.abspath(__file__))

# HTTP GET Request
request = requests.get('https://homepage.sch.ac.kr/sch/05/05010000.jsp')

# GET HTML Source
html = request.text

# Use BeautifulSoup, From HTML Source to Python Object
# First Parameter is HTML Source, Second Parameter is the parser to be used
soup = BeautifulSoup(html, 'html.parser')

# HTML element using CSS Selector
schedules = soup.find_all('a', {'class' : 'schedule'})

schedule_day = []
schedule_list = []

for schedule in schedules:
# 날짜 가져오기
schedule_day.append(schedule.text)
# 세부 내용 가져오기
schedule_list.append(schedule.get('title'))

idx = 0

result_message = '의 학사일정\n'

for schedule in schedule_day :
schedule_message = '\n[' + str(schedule) + '일 일정]\n' + '· ' + schedule_list[idx]
result_message = str(result_message) + schedule_message
idx += 1

# GET HTTP Header
header = request.headers

# GET HTTP Status ( 200 : normal )
status = request.status_code

# Check HTTP ( TRUE / FALSE )
is_HTTP_OK = request.ok

return result_message
23 changes: 23 additions & 0 deletions app/my_module/stringformat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 선택한 버튼이 학식 메뉴일 경우 메세지 포매팅
select_button = '[*] 선택한 버튼 : {0}\n[*] {1}의\n[*] {0} 메뉴입니다.\n'

# 선택한 버튼이 학식이 아닐 경우
select_else_button = '[*] 선택한 버튼 : {0}\n'

# 종강 버튼 선택 시
end_day = '[*] 오늘 : {0}\n[*] 종강 : {1}\n[*] 종강까지 {2}일 남았습니다.'

# json 파일 오픈 예외 문자
json_open_error = '\n에러메세지가 보이면 관리자에게 알려주세요.'

# 일요일 예외
sun_except = '\n일요일에 {0} 식당은\n운영하지 않습니다.'

# 주말 예외
weekend_except = '\n주말에 {0} 식당은\n운영하지 않습니다.'

# Wi-Fi 정보
wifi_info = '[*] ID : H(대문자)+학번(8자리)\n[*] 비밀번호 : 생년월일\n[*] 예시 : H20171234\n[*] 예시 : 980101'

# 심각한 오류
fatal_error = '[*] 심각한 오류입니다.\n[*] 개발자에게 알려주세요'
Loading

0 comments on commit 22a2d0c

Please sign in to comment.