Giter VIP home page Giter VIP logo

linebot_devnote's Introduction

LineBot開發

本專案目前已經沒有在維護

Demo

BotQR.png

1.請掃描QR Code加入好友

2.Demo用學號:b0742024

3.輸入後可以查看目前成績、自評成績、是否通過老師設定門檻

使用技術與考量

  1. LineBot (Python+Flask) 服務內容較為簡單 輕量級框架較為適合
  2. Models(matplotlib+pandas+numpy) 讀取成績內容進行操作並繪製圖表
  3. Database(excel) 方便TA直接輸入成績 無須再將成績csv檔輸入資料庫

參考資料

line/line-bot-sdk-python

Flask + Apache 架在windows上

[Pandas教學]5個實用的Pandas讀取Excel檔案資料技巧

Sending Flex Messages

遭遇問題

  1. 在虛擬環境中,matplotlib的中文亂碼問題。 需要去 anaconda中的env 安裝matplotlib字體的資料夾增加字體可參考下方教學連結

    Python教學-如何解決matplotlib中文亂碼問題

  2. Linebot如何傳遞複數訊息給使用者?

    reply_arr=[]
    reply_arr.append(TextSendMessage("Demo")
    reply_arr.append(TextSendMessage("Test")
    line_bot_api.reply_message(event.reply_token,reply_arr)
  3. plt.savefig()多次使用會覆蓋前面的圖片,須加上plt.close()

  4. Git如何返回前一個版本以及刪除某次commit

    !git reset --hard HEAD~  #等於~1  ~n等於回到前幾個版本
  5. df中空值要補0 否則無法畫圖

    df=df.fillna(0)
  6. 如何在成績達標後變色?將通過的科目存成一個[(math,0),(english,1)]這樣的list 後如下方式處理

    rects1 = ax.bar(x +width/2, grade, width,color='#84C1FF')   #學生目前成績
    for i, bar in enumerate(rects1): 
                if flag[i] == 0 : 
                    bar.set_color("#FF7575")      #不及格的顏色
  7. 如何讀取一份excel中的多個sheet?將不同的sheet合併到一個DataFrame中

    def create_data():
        df = pd.DataFrame()
        data = pd.read_excel("測試成績單.xlsx", sheet_name=None,engine='openpyxl')
        sheet = pd.ExcelFile("測試成績單.xlsx",engine='openpyxl')
        for s_name in sheet.sheet_names:
            df = pd.concat([df, data.get(s_name)], ignore_index=False)
    
        return df

Future Work

  • 將成績訊息改用flex message傳送
  • 部署至apache 伺服器而非使用ngrok
  • 美化Flex Message 的排版
  • 將目前code寫成物件導向
  • 增加程式碼彈性與使用性,方便老師新增科目、調整評分、修改圖表顏色等

linebot_devnote's People

Contributors

dfgh012316 avatar qq96932100 avatar

Stargazers

 avatar  avatar Wei-Chih, Chen avatar

Watchers

 avatar

Forkers

qq96932100 scpit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.