Results 1 to 4 of 4
  1. #1
    Regional2000's Avatar
    Join Date
    Mar 2019
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0

    Question Google Forms to D.I.S.C.O.R.D.

    I found code that uses D.I.S.C.O.R.D. Webhook to Google Forms and posts the answers into one channel but I couldn't wrap my head around getting specific answers only getting posted. Ex.) 1st Sections has 4 Questions and each question leads to another Sections based on the answer so 5 Sections in total, With that outcome I wanted to only obtain Section 1 Answer and the Section I went to (2,3,4,5).
    Here is the code that I found, I'll really appreciate help.
    Code:
    var POST_URL = "WEBHOOK";
    
    function onSubmit(e) {
      var form = FormApp.getActiveForm();
      var allResponses = form.getResponses();
      var latestResponse = allResponses[allResponses.length - 1];
      var response = latestResponse.getItemResponses();
      var items = [];
    
      for (var i = 0; i < response.length; i++) {
        var question = response[i].getItem().getTitle();
        var answer = response[i].getResponse();
        try {
          var parts = answer.match(/[\s\S]{1,1024}/g) || [];
        } catch (e) {
          var parts = answer;
        }
    
        if (answer == "") continue;
    
        for (var j = 0; j < parts.length; j++) {
          if (j == 0) items.push({
            "name": question,
            "value": parts[j],
            "inline": false
          });
          else items.push({
            "name": question.concat(" (cont.)"),
            "value": parts[j],
            "inline": false
          });
        }
      }
    
      var options = {
        "method": "post",
        "headers": {"Content-Type": "application/json"},
        "payload": JSON.stringify({
          "content": " ",
          "embeds": [{
            "title": "**Incoming Form Submission**",
            "color": 15844367,
            "fields": items,
            "footer": {
              "text": "Thank You for your time! :)"
            }
          }]
        })
      };
    
      UrlFetchApp.fetch(POST_URL, options);
    };

  2. #2
    Lampmagicalbible's Avatar
    Join Date
    Feb 2020
    Gender
    male
    Posts
    29
    Reputation
    10
    Thanks
    4
    I'm dumb. What's D.I.S.C.O.R.D? You mean ******* for chat gaming? You are trying to make a bot that gives ANSWERS** to anyone who fills out form? This sounds like a freelancer job.
    here is what i found
    https://patents.google.com/patent/US...orm+script+bot <--- blueprint

    it sound like a simple if and then program found in most programming books. it sound like you stole this code off someone else server. but here is the resource for direct assistance on bot commands in D.I.S.C.O.R.D
    Last edited by Lampmagicalbible; 07-19-2020 at 11:38 AM. Reason: censor

  3. #3
    Regional2000's Avatar
    Join Date
    Mar 2019
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    Thank you for the help Lampmagicalbible I feel so dumb and never even realized the IF and Then function inside of it.
    I got it to work.

  4. #4
    merleahoms's Avatar
    Join Date
    Mar 2022
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    Hi! And then how do you use this code?.

Similar Threads

  1. [Other] UK - Google Home Mini 100% OFF SERVICE GIVEAWAY FORM
    By subwaymaster in forum Giveaways
    Replies: 32
    Last Post: 09-03-2019, 09:15 PM
  2. [Request] Simple Google Form spammer
    By K4LI in forum Coders Lounge
    Replies: 3
    Last Post: 02-20-2019, 05:01 AM
  3. Why google forms are banned from IM....
    By Bllush in forum Help & Requests
    Replies: 1
    Last Post: 08-15-2018, 11:56 AM
  4. Bring Back Google Form Links to IM
    By Premium in forum Marketplace Talk
    Replies: 11
    Last Post: 07-08-2018, 04:29 PM
  5. Google forms alternative?
    By Dama in forum Marketplace Talk
    Replies: 8
    Last Post: 07-01-2018, 07:34 AM