-
Notifications
You must be signed in to change notification settings - Fork 0
/
Function.py
231 lines (224 loc) · 7.65 KB
/
Function.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
from linebot import (LineBotApi, WebhookHandler)
from linebot.exceptions import (InvalidSignatureError)
from linebot.models import *
import requests
from bs4 import BeautifulSoup
#TemplateSendMessage - ButtonsTemplate (按鈕介面訊息)
def menu1():
message = TemplateSendMessage(
alt_text='功能列表',
template=ButtonsTemplate(
thumbnail_image_url="https://i.imgur.com/QPc6mx8.jpg",
title="功能列表",
text="想要什麼功能呢?",
actions=[
# DatetimePickerTemplateAction(
# label="請選擇生日",
# data="input_birthday",
# mode='date',
# initial='1990-01-01',
# max='2019-03-10',
# min='1930-01-01'
# ),
#
PostbackTemplateAction(
label="各飛場位置",
# text="飛場位置",
data='FlyField'
),
# PostbackTemplateAction(
# label="遙控器撥桿功能(BetaFlight)",
# data="StickFun"
# ),
MessageTemplateAction(
label="穿越機介紹",
text="穿越機介紹"
),
PostbackTemplateAction(
label="各韌體目前版本",
# text="各韌體目前版本",
data="FirmwareVer"
),
PostbackTemplateAction(
label="下一頁",
# text="雷達"
data="to_menu2"
)
]
)
)
return message
def menu2():
message = TemplateSendMessage(
alt_text='功能列表',
template=ButtonsTemplate(
thumbnail_image_url="https://i.imgur.com/QPc6mx8.jpg",
title="功能列表2",
text="想要什麼功能呢?",
actions=[
PostbackTemplateAction(
label="其他(暫時)",
# text="飛場位置",
data='droneInfo'
),
PostbackTemplateAction(
label="下一頁",
# text="雷達"
data="to_menu3"
)
]
)
)
return message
def field_location():
message = TemplateSendMessage(
alt_text='飛場位置',
template=ButtonsTemplate(
thumbnail_image_url="https://i.imgur.com/QPc6mx8.jpg",
title="飛場位置",
text="選擇您想去的位置",
actions=[
MessageTemplateAction(
label="烏日",
text="烏日飛場",
),
MessageTemplateAction(
label="埔里",
text="埔里飛場"
),
MessageTemplateAction(
label="一江橋",
text="一江橋飛場"
),
PostbackTemplateAction(
label="下一頁",
# text="下一頁",
data = "FlyField2"
),
]
)
)
return message
def field_location_2():
message = TemplateSendMessage(
alt_text='飛場位置(二)',
template=ButtonsTemplate(
thumbnail_image_url="https://i.imgur.com/QPc6mx8.jpg",
title="飛場位置(二)",
text="選擇您想去的位置",
actions=[
MessageTemplateAction(
label="員林",
text="員林飛場"
),
MessageTemplateAction(
label="遠雄之星",
text="遠雄之星"
),
MessageTemplateAction(
label="芬園",
text="芬園飛場"
),
]
)
)
return message
def firmware_version():
message = TemplateSendMessage(
alt_text='目前韌體版本',
template=ButtonsTemplate(
thumbnail_image_url="https://i.imgur.com/QPc6mx8.jpg",
title="查看韌體當前版本",
text="選擇您想知道的韌體",
actions=[
PostbackTemplateAction(
label="BetaFlight",
# text="Beta_Version",
data='BetaVersion'
),
PostbackTemplateAction(
label="Inav",
# text="InavVersion",
data="InaVersion"
),
PostbackTemplateAction(
label="OpenTX",
# text="OpenTxVersion",
data="OpenTxVersion"
),
PostbackTemplateAction(
label="EdgeTX",
# text="EdgeTxVersion",
data="EdgeTxVersion"
),
]
)
)
return message
#TemplateSendMessage - ConfirmTemplate(確認介面訊息)
def carousel_template():
carousel_template_message = TemplateSendMessage(
alt_text='Carousel template',
template=CarouselTemplate(
columns=[
CarouselColumn(
thumbnail_image_url='https://i.imgur.com/FyOetwJ.jpg',
title='穿越機招式教學',
text='建議要先在模擬器測試動作,再上實機測試。',
actions=[
URIAction(
label='招式教學(初級)',
uri='https://www.youtube.com/watch?v=VnKg2aCTPtk&list=PLj23ZLg5V56prLy-r3-GVd_9wBU4iVC7H'
),
URIAction(
label='招式教學(中級)',
uri='https://www.youtube.com/watch?v=FamqCNGrq2M&list=PLj23ZLg5V56qvExRVYQkBq6bUsJjwHQqZ'
),
URIAction(
label='招式教學(高級)',
uri='https://www.youtube.com/watch?v=rsA_llKYtSE&list=PLj23ZLg5V56q99molL1nY1XVa0j42cnzl'
)
]
),
CarouselColumn(
thumbnail_image_url='https://i.imgur.com/6IFuqL2.png',
title='天氣相關',
text='天氣預測,地震資訊等等...',
actions=[
MessageAction(
label='雷達回波圖',
text='雷達'
),
MessageAction(
label='最近一次地震',
text='地震'
),
# URIAction(
# label='uri2',
# uri='http://example.com/2'
# )
]
)
]
)
)
return carousel_template_message
def Confirm_Template():
message = TemplateSendMessage(
alt_text='是否註冊成為會員?',
template=ConfirmTemplate(
text="是否註冊成為會員?",
actions=[
PostbackTemplateAction(
label="馬上註冊",
text="現在、立刻、馬上",
data="會員註冊"
),
MessageTemplateAction(
label="查詢其他功能",
text="查詢其他功能"
)
]
)
)
return message