Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. var POST_URL = "https://discordapp.com/api/webhooks/467762739180339204/sEbIS-utJLiJybVzx6pADUG3JgCp9Qz8FvMJC3AAu85bgY7-oYdRQTuu9JnhCulUYmV2";
  2.  
  3. function onSubmit(e) {
  4. var response = e.response.getItemResponses();
  5. var items = [];
  6.  
  7. for (var i = 0; i < response.length ; i++) {
  8. var question = response[i].getItem().getTitle();
  9. var answer = response[i].getResponse();
  10. var parts = answer.match(/[\s\S]{1,1024}/g) || [];
  11.  
  12. if (answer == "") {continue;}
  13. for (var j = 0; j< parts.length; j++) {
  14. if (j == 0) {
  15. items.push({"name": question, "value": parts[j], "inline": false});
  16. } else {
  17. items.push({"name": question.concat(" (cont.)"), "value": parts[j], "inline": false});
  18. }
  19. }
  20. }
  21.  
  22. var options = {
  23. "method" : "post",
  24. "payload": JSON.stringify({
  25. "content": '<@&336428142035992596>',
  26. "embeds": [
  27. {
  28. "title":"**New bugreport submitted.**",
  29. "fields":items,
  30. "footer":{"text": "/End of form"}
  31. }
  32. ]
  33. }
  34. )
  35. };
  36.  
  37. UrlFetchApp.fetch(POST_URL, options);
  38. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement