Skip to content

Instantly share code, notes, and snippets.

@MKtalk
Created September 7, 2017 05:01
Show Gist options
  • Save MKtalk/ce4683cd2e7cbbfe0cdbdfbbac9f0d86 to your computer and use it in GitHub Desktop.
Save MKtalk/ce4683cd2e7cbbfe0cdbdfbbac9f0d86 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function, unicode_literals)
from bothub_client.bot import BaseBot
from bothub_client.messages import Message
from .weather import get_weather
class Bot(BaseBot):
def handle_message(self, event, context):
location = event.get('location')
appid = '<your key>'
if location:
lat = location['latitude']
lon = location['longitude']
weather = get_weather(lat, lon, appid)
self.send_message(weather)
msg = Message(event).set_text('날씨 확인을 위해 현재 위치를 전송해주세요.') \
.add_location_request('Send Location')
self.send_message(msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment