wlstp8473

resturan location using html map

......@@ -3,7 +3,7 @@ import telegram
from telegram.ext import Updater
from telegram.ext import MessageHandler, Filters
import os
import webbrowser
import telegram
from telegram.ext import Updater
from telegram.ext import MessageHandler, Filters
......@@ -132,6 +132,8 @@ place_url_list = [ x_['place_url'] for x_ in result_5['documents']]
x_list = [ x_['x'] for x_ in result_5['documents']]
y_list = [ x_['y'] for x_ in result_5['documents']]
#print(y_list)
#print(x_list)
......@@ -149,6 +151,7 @@ total_count_num = str(total_count_list[0])
total_count_num = int(total_count_num)
resturant_info = ""
resturant_string = "관련 음식점 정보: " + '\n'
resturant_location_string = "음식점의 x y좌표" + '\n'
#프린트 결과를 리턴받기 위한 함수
#from io import StringIO
......@@ -161,6 +164,12 @@ for i in range(0,10): #total_count_num가 너무 크면 인덱스 범위가 벗
resturant_info = [place_name_list[i] + " " +phone_list[i] + " " + road_address_name_list[i] + " " + place_url_list[i]]
resturant_string += str(resturant_info) + "\n" + "\n"
for i in range(0,10): #total_count_num가 너무 크면 인덱스 범위가 벗어나서 실행이 안됨, 임시로 10개까지만
resturant_location = [x_list[i] + ", " + y_list[i]]
resturant_location_string += str(resturant_location) + "\n"
########################### 날씨 크롤링 기능 ########################
......@@ -213,6 +222,8 @@ def covid_news_crawling():
if title_list.index(i) == 2:
break
return output_result
......@@ -225,7 +236,7 @@ updater = Updater(token=token, use_context=True)
dispatcher = updater.dispatcher
updater.start_polling()
url="file:///C:/Users/user/Documents/project_opensw-chatbot/telegram_Messenger_Chatbot/index.html"
#가능한 응답 리스트 목록
menual_message = '''사용가능한 기능 #(모해?) #(맛집) #(오늘 날씨) #(코로나 정보) #(기능) '''
......@@ -271,6 +282,10 @@ def handler(update, context):
# 맛집 키워드 답장
elif ("맛집" in user_text):
bot.sendMessage(chat_id=id, text=resturant_string)
#bot.sendMessage(chat_id=id, text=resturant_location_string) 음식점 xy좌표 반환할 거임
bot.sendMessage(chat_id=id, text = webbrowser.open(url)) #############################webpage 내 위치 기바ㄴ
elif ("고마워" in user_text):
bot.send_message(chat_id=id, text="웅 ㅎㅎ")
......@@ -286,7 +301,7 @@ def handler(update, context):
weather_info = weather_info_crawling()
bot.send_message(chat_id=id, text= weather_info)
bot.sendMessage(chat_id=id, text=react_weather)
#bot.send_photo(chat_id=id, photo=open(r'C:\Users\user\Documents\project_opensw-chatbot\telegram_Messenger_Chatbot\img\weather_cloth_info.jpg', 'rb')) ###절대 경로니까 수정하세요!!!!!!
if (find_currenttemp_num()>=27):
bot.send_message(chat_id=id, text="와 미친,, 27도가 넘는데? 낼 무조건 시원하게 얇고 통풍 잘 되는 거 입어, 쪄 죽겠다 ㅋㅋㅋㅋ")
elif (find_currenttemp_num()>=23):
......@@ -315,6 +330,7 @@ def handler(update, context):
elif (user_text == "기능"):
bot.sendMessage(chat_id=id, text=menual_message_info)
else:
update.message.reply_text("ㅎㅎ")
......