Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var POST_URL = "https://discordapp.com/api/webhooks/598146825551216651/LOO5C1FDOkaDi5o_kVjYPCD0EKP9IJpPh9iGkuFow4VpjOkP6vZ5NHb02mSkjh4k5dds";
- 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();
- var parts = answer.match(/[\s\S]{1,1024}/g) || [];
- 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",
- "payload": JSON.stringify({
- "embeds": [{
- "title": "New event idea!",
- "fields": items,
- "footer": {
- "text": "Please speak to the member for any further questions"
- }
- }]
- })
- };
- UrlFetchApp.fetch(POST_URL, options);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement