質問編集履歴

1

ソースコードを

2018/09/30 14:21

投稿

qwerty114514
qwerty114514

スコア13

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,74 @@
1
+ ```Python
2
+
1
- ![イメージ説明](e319f799b547a6932e074d521a9b2721.png)
3
+ @handler.add(MessageEvent, message=TextMessage)
4
+
5
+ def handle_message(event):
6
+
7
+ global near_station_name
8
+
9
+ global near_station_address
10
+
11
+ global near_station_geo_lat
12
+
13
+ global near_station_geo_lon
14
+
15
+
16
+
17
+ if event.type == "message":
18
+
19
+ if event.message.text.find("駅"):
20
+
21
+ line_bot_api.reply_message(
22
+
23
+ event.reply_token,
24
+
25
+ TextSendMessage("位置情報を送信したら最寄り駅の情報を送信します。\n" + "line://nv/location",
26
+
27
+ )
28
+
29
+ if event.message.text == ("位置情報教えて"):
30
+
31
+ line_bot_api.reply_message(
32
+
33
+ event.reply_token,
34
+
35
+ [
36
+
37
+ LocationSendMessage(
38
+
39
+ title=near_station_name,
40
+
41
+ address=near_station_address,
42
+
43
+ latitude=near_station_geo_lat,
44
+
45
+ longitude=near_station_geo_lon
46
+
47
+ ),
48
+
49
+ TextSendMessage(text="タップした後右上のボタンからGoogleMapsなどで開けますよ"+ chr(0x100079)),
50
+
51
+ TextSendMessage(text="もし場所が間違えてたらもう一度地図画像をタップしてみたり位置情報を送り直してみてください"),
52
+
53
+ ]
54
+
55
+ )
56
+
57
+ else:
58
+
59
+ line_bot_api.reply_message(
60
+
61
+ event.reply_token,
62
+
63
+ [
64
+
65
+ TextSendMessage(text="まだその言葉は教えてもらってないんです"+ chr(0x100029) + chr(0x100098)),
66
+
67
+ ]
68
+
69
+ )
70
+
71
+ ```
2
72
 
3
73
 
4
74