diff --git a/README.md b/README.md
index 561bca2a..65cb3ec8 100644
--- a/README.md
+++ b/README.md
@@ -124,10 +124,14 @@ Python과 Django 웹 프레임워크를 사용하여 제작한 자동 응답형
- 버튼 메뉴 세분화 완료
2018/05/14
-- Version [(2.2.1)](https://github.com/alstn2468/SCH_Food_ChatBot/commit/22a2d0cd5613c5398dfb8c6656467389f1acbfbb) New Function Updated / Source Code Modularization
+- Version [(2.2.0)](https://github.com/alstn2468/SCH_Food_ChatBot/commit/22a2d0cd5613c5398dfb8c6656467389f1acbfbb) New Function Updated / Source Code Modularization
- 학교 Wi-Fi 기능 추가 완료
- 소스 코드 모듈화 완료
+2018/05/16
+- Version [(2.3.0)](https://github.com/alstn2468/SCH_Food_ChatBot/commit/22a2d0cd5613c5398dfb8c6656467389f1acbfbb) New Function Updated / Source Code Modularization
+- 식당 이용 시간 확인 기능 추가 완료
+- 소스 코드 모듈화 완료
## 친구 추가
diff --git a/app/my_module/button.py b/app/my_module/button.py
index ba9ed2dc..66ff3d08 100644
--- a/app/my_module/button.py
+++ b/app/my_module/button.py
@@ -8,6 +8,12 @@
'개발자 정보'
]
+food_info_button = [
+'메뉴',
+'이용 시간',
+'처음으로'
+]
+
food_sel_process_button = [
'향설1 생활관',
'향설2 생활관',
diff --git a/app/my_module/process.py b/app/my_module/process.py
new file mode 100644
index 00000000..32706999
--- /dev/null
+++ b/app/my_module/process.py
@@ -0,0 +1,53 @@
+from django.http import JsonResponse
+from app.my_module.button import *
+import requests
+
+# 결과를 출력하고 다시 입력을 받기 위한 함수
+def re_process(output) :
+
+ return JsonResponse (
+ {
+ 'message':
+ {
+ 'text': output
+ },
+ 'keyboard':
+ {
+ 'type': 'buttons',
+ 'buttons' : basic_button
+ }
+ }
+ )
+
+# 학식 버튼을 눌렀을 때 세부 버튼을 받기 위한 함수
+def food_sel_process() :
+
+ return JsonResponse (
+ {
+ 'message' :
+ {
+ 'text' : '어느 곳의 메뉴가 궁금하신가요?'
+ },
+ 'keyboard' :
+ {
+ 'type' : 'buttons',
+ 'buttons' : food_sel_process_button
+ }
+ }
+ )
+
+def food_info_process() :
+
+ return JsonResponse (
+ {
+ 'message' :
+ {
+ 'text' : '[확인할 수 있는 정보]\n· 메뉴\n· 이용 시간'
+ },
+ 'keyboard' :
+ {
+ 'type' : 'buttons',
+ 'buttons' : food_info_button
+ }
+ }
+ )
diff --git a/app/my_module/repdic.py b/app/my_module/repdic.py
index ca285964..cfc49ebb 100644
--- a/app/my_module/repdic.py
+++ b/app/my_module/repdic.py
@@ -29,3 +29,12 @@
'\n·\n' : '\n\n',
'·' : '· '
}
+
+# 데이터를 보기 좋게 출력하기 위한 문자열 처리 함수
+def char_replace(meal) :
+
+ for key, value in trans_dic.items() :
+
+ meal = meal.replace(key, value)
+
+ return meal
diff --git a/app/my_module/stringformat.py b/app/my_module/stringformat.py
index 6f61690e..f1d07cbe 100644
--- a/app/my_module/stringformat.py
+++ b/app/my_module/stringformat.py
@@ -21,3 +21,19 @@
# 심각한 오류
fatal_error = '[*] 심각한 오류입니다.\n[*] 개발자에게 알려주세요'
+
+# 이용 가능 시간
+using_time = '''
+[향설1 생활관]
+[향설2 생활관]
+[향설3 생활관]
+[학생회관]
+[교직원 식당]'''
+
+# 개발자 정보 메세지
+dev_info = '''[*] 컴퓨터소프트웨어공학과
+[*] 17학번 김민수
+[*] Github : alstn2468
+[*] KakaoTalk : alstn2468
+[*] 새로운 기능 문의 환영
+[*] 에러 발견 문의 환영'''
diff --git a/app/views.py b/app/views.py
index a187b9a9..4609a9c1 100644
--- a/app/views.py
+++ b/app/views.py
@@ -1,10 +1,11 @@
from django.shortcuts import render
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
-from app.my_module.button import *
from app.my_module.repdic import *
from app.my_module.scheduleparser import *
from app.my_module.stringformat import *
+from app.my_module.process import *
+from app.my_module.button import *
from pytz import timezone
import requests, datetime, json
@@ -15,63 +16,12 @@
# menu/StudentUnion.json 학생 회관
# menu/FacultyRestaurant.json 교직원 식당
-# 개발자 정보 메세지
-dev_info = '''[*] 컴퓨터소프트웨어공학과
-[*] 17학번 김민수
-[*] Github : alstn2468
-[*] KakaoTalk : alstn2468
-[*] 새로운 기능 문의 환영
-[*] 에러 발견 문의 환영'''
-
-# 데이터를 보기 좋게 출력하기 위한 문자열 처리 함수
-def char_replace(meal) :
-
- for key, value in trans_dic.items() :
-
- meal = meal.replace(key, value)
-
- return meal
-
-# 결과를 출력하고 다시 입력을 받기 위한 함수
-def re_process(output) :
-
- return JsonResponse (
- {
- 'message':
- {
- 'text': output
- },
- 'keyboard':
- {
- 'type': 'buttons',
- 'buttons' : basic_button
- }
- }
- )
-
-# 학식 버튼을 눌렀을 때 세부 버튼을 받기 위한 함수
-def food_sel_process() :
-
- return JsonResponse (
- {
- 'message' :
- {
- 'text' : '어느 곳의 메뉴가 궁금하신가요?'
- },
- 'keyboard' :
- {
- 'type' : 'buttons',
- 'buttons' : food_sel_process_button
- }
- }
- )
-
def keyboard(request) :
return JsonResponse (
{
- 'type' : 'buttons',
- 'buttons' : basic_button
+ 'type' : 'buttons',
+ 'buttons' : basic_button
}
)
@@ -90,8 +40,19 @@ def answer(request) :
today_weekday = today.weekday()
if content_name == '학식' :
+
+ return food_info_process()
+
+ elif content_name == '메뉴' :
+
return food_sel_process()
+ elif content_name == '이용 시간' :
+
+ send_message = select_else_button.format(content_name) + using_time
+
+ return re_process(send_message)
+
elif content_name == '향설1 생활관' :
try :
@@ -279,7 +240,6 @@ def answer(request) :
finish_info = finish.strftime('%Y년 %m월 %d일')
date_dif = finish - today
-
send_message = select_else_button.format(content_name) + end_day.format(today_info, finish_info, date_dif.days)
except Exception as e :