Prechádzať zdrojové kódy

Merge branch 'master' of http://git.choozmo.com:3000/choozmo/ArkCard-Linebot into master

jeter20131220 3 rokov pred
rodič
commit
7c3d28af53
3 zmenil súbory, kde vykonal 3 pridanie a 21 odobranie
  1. 1 0
      .gitignore
  2. 0 3
      config.ini
  3. 2 18
      main.py

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+.DS_Store

+ 0 - 3
config.ini

@@ -1,3 +0,0 @@
-[line-bot]
-channel_access_token = SJT7VPT4RMQFLcS27jQBy3FcC24gtDrkcwJWZ5Xzqesr5T78LOKudHEJzt0k3b2S7n4KPwf27J7DVz2c8NQ4plSaaQylEeB1cYrfejaE/RPG/lCIQBYe4iBTzo26s4i2PcmT89837per/lTyvhVIKAdB04t89/1O/w1cDnyilFU=
-channel_secret = 411ae3ef7e766739ed2c2c27b249d010

+ 2 - 18
main.py

@@ -5,16 +5,13 @@ from linebot import LineBotApi, WebhookHandler
 from linebot.models import ( 
     MessageEvent, TextMessage, TextSendMessage, FollowEvent, 
     )
-import configparser
 
 app = fastapi.FastAPI()
 
 # bot config
-config = configparser.ConfigParser()
-config.read('config.ini')
+line_bot_api = LineBotApi("SJT7VPT4RMQFLcS27jQBy3FcC24gtDrkcwJWZ5Xzqesr5T78LOKudHEJzt0k3b2S7n4KPwf27J7DVz2c8NQ4plSaaQylEeB1cYrfejaE/RPG/lCIQBYe4iBTzo26s4i2PcmT89837per/lTyvhVIKAdB04t89/1O/w1cDnyilFU=")
+handler = WebhookHandler("411ae3ef7e766739ed2c2c27b249d010")
 
-line_bot_api = LineBotApi(config.get('line-bot', 'channel_access_token'))
-handler = WebhookHandler(config.get('line-bot', 'channel_secret'))
 
 # callback event
 @app.post("/callback")
@@ -32,19 +29,6 @@ def handle_follow(event):
         event.reply_token,
         TextSendMessage(text='歡迎加入好友'))                                
 
-# # test answer, echo handler
-# @handler.add(MessageEvent, message=TextMessage)
-# def echo(event):
-#     if '誰' in event.message.text:
-#         line_bot_api.reply_message(
-#             event.reply_token,
-#             TextSendMessage(text='我是您的專屬祕書'))
-
-#     else:
-#         line_bot_api.reply_message(
-#             event.reply_token,
-#             TextSendMessage(text=event.message.text)
-#         )
 
 if __name__ == '__main__':
     uvicorn.run("main:app", host="127.0.0.1", port=5000, reload=True)