Your Name 3 yıl önce
ebeveyn
işleme
e2fef4ab66
1 değiştirilmiş dosya ile 46 ekleme ve 0 silme
  1. 46 0
      step_question/apis/newbot.py

+ 46 - 0
step_question/apis/newbot.py

@@ -4,6 +4,23 @@ import fastapi.staticfiles as fastapiStaticfiles
 import linebot
 import linebot.models as linebotModels
 
+from linebot.models import (
+    MessageEvent, TextMessage, TextSendMessage,
+    SourceUser, SourceGroup, SourceRoom,
+    TemplateSendMessage, ConfirmTemplate, MessageAction,
+    ButtonsTemplate, ImageCarouselTemplate, ImageCarouselColumn, URIAction,
+    PostbackAction, DatetimePickerAction,
+    CameraAction, CameraRollAction, LocationAction,
+    CarouselTemplate, CarouselColumn, PostbackEvent,
+    StickerMessage, StickerSendMessage, LocationMessage, LocationSendMessage,
+    ImageMessage, VideoMessage, AudioMessage, FileMessage,
+    UnfollowEvent, FollowEvent, JoinEvent, LeaveEvent, BeaconEvent,
+    MemberJoinedEvent, MemberLeftEvent,
+    FlexSendMessage, BubbleContainer, ImageComponent, BoxComponent,
+    TextComponent, IconComponent, ButtonComponent,
+    SeparatorComponent, QuickReply, QuickReplyButton,
+    ImageSendMessage)
+
 #uvicorn main:app --host 0.0.0.0 --port 443 --ssl-keyfile=/etc/letsencrypt/live/cal.ptt.cx/privkey.pem --ssl-certfile=/etc/letsencrypt/live/cal.ptt.cx/fullchain.pem
 #uvicorn main:app --host 0.0.0.0 --port 443 --ssl-keyfile=/etc/letsencrypt/live/ptt.cx/privkey.pem --ssl-certfile=/etc/letsencrypt/live/ptt.cx/chain.pem
 
@@ -56,6 +73,35 @@ def message_text(event):
         line_bot_api.reply_message(
             event.reply_token,
             TextSendMessage(text='ChoozMo 的FastAPI LINE Bot'))
+    if event.message.text=='btn':
+        line_bot_api.reply_message(
+                    event.reply_token,
+                    TextSendMessage(
+                        text='Quick reply',
+                        quick_reply=QuickReply(
+                            items=[
+                                QuickReplyButton(
+                                    action=PostbackAction(label="label1", data="data1")
+                                ),
+                                QuickReplyButton(
+                                    action=MessageAction(label="label2", text="text2")
+                                ),
+                                QuickReplyButton(
+                                    action=DatetimePickerAction(label="label3",
+                                                                data="data3",
+                                                                mode="date")
+                                ),
+                                QuickReplyButton(
+                                    action=CameraAction(label="label4")
+                                ),
+                                QuickReplyButton(
+                                    action=CameraRollAction(label="label5")
+                                ),
+                                QuickReplyButton(
+                                    action=LocationAction(label="label6")
+                                ),
+                            ])))
+
 
 
 #if __name__ == "__main__":