Giter Site home page Giter Site logo

coreteam-googleform's Introduction

CoreTeam-GoogleForm 雲林科技大學 GDSC Core Team 招募表單機器人

NYUST GDSC CoreTeam 招生表單

For Manager


Core Technic 核心技術

  • Google Form
  • Google App Script
  • Discord Webhook Bot

Get Started 開始進行

Step.1 建立 Google Form

建立好 Google Form 樣式

Step.2 根據 Google Form 表單取得需要的資料

範例程式

    const response = e.response.getItemResponses();
    let items = [];

    for (const responseAnswer of response) {
        const question = responseAnswer.getItem().getTitle(); // 取得表單標題
        const answer = responseAnswer.getResponse(); //取得表單回應
        let parts = []

        try {
            parts = answer.match(/[\s\S]{1,1024}/g) || [];
        } catch (e) {
            parts = answer;
        }

        if (!answer) {
            continue;
        }

        for (const [index, part] of Object.entries(parts)) {
            if (index == 0) {
                items.push({
                    "name": question,
                    "value": part,
                    "inline": false
                });
            } else {
                items.push({
                    "name": question.concat(" (cont.)"),
                    "value": part,
                    "inline": false
                });
            }
        }
    }

Step.3 建立發布通知的 Discord 頻道

編輯頻道資訊

找到 Integration 按下 Create Webhook

系統會自建一個基本的 Webhook Bot 給你

可以根據需求進行名稱修改,修改完畢記得 Copy Webhook URL

貼上至程式中的 Webhook 變數中

const POST_URL = "<Your Webhook URL>";

Step.4 將程式加入 Google Form

點選指令碼編輯器

Step.5 設定觸發條件

點選 [觸發條件] -> [新增觸發條件]

設定活動類型為 [提交表單時]

若出現以下情形,代表程式碼內尚未有任何函示可以觸發。解決方法:儲存程式碼並重新整理

設定完觸發條件後,就大功告成啦 !!!

成果圖


結語

若路過的朋友覺得這份專案還不錯,歡迎給予專案星星以及 Follow NYUST GDSC

coreteam-googleform's People

Contributors

leolee-0531 avatar fan9704 avatar

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.