function onSubmit(e) {
var discordUrl = '';
var formResponse = e.response;
var itemResponses = formResponse.getItemResponses();
var channelMsg;
var discordname, aboutme, software, experience, portfolio, advertisement, availability, agreement;
for (i in itemResponses){
//I prefer to list the variables up here so I'm sure about the number of questions
var rank, name, badge;
//Make a separate if-condition for each question you have, and make sure the case and
//punctuation match what's on your form
if (itemResponses[i].getItem().getTitle() == "Video Editor Application")
{
//And then set your respective variable with the response from the form
name = itemResponses[i].getResponse();
}
//And then you can just copy/paste each if-condition for each question you have, editing the title and variable for your question
if (itemResponses[i].getItem().getTitle() == "What is your Discord username? (Ex: BostonAlex)")
{
discordname = itemResponses[i].getResponse();
}
if (itemResponses[i].getItem().getTitle() == "Tell me about yourself so we can learn who you are as a person!")
{
aboutme = itemResponses[i].getResponse();
}
if (itemResponses[i].getItem().getTitle() == "What editing software do you use?")
{
software = itemResponses[i].getResponse();
}
if (itemResponses[i].getItem().getTitle() == "How long have you been editing content for?")
{
experience = itemResponses[i].getResponse();
}
if (itemResponses[i].getItem().getTitle() == "Do you have a portfolio that shows previous work? If so, what is the link to it?")
{
portfolio = itemResponses[i].getResponse();
}
if (itemResponses[i].getItem().getTitle() == "Where did you hear about this opportunity to become an editor for BostonAlex?")
{
advertisement = itemResponses[i].getResponse();
}
if (itemResponses[i].getItem().getTitle() == "How much time do you have to dedicate to making videos?")
{
availability = itemResponses[i].getResponse();
}
if (itemResponses[i].getItem().getTitle() == "You understand + agree this is a paid position within the BostonAlex team and may be working alongside BostonAlex with editing the footage to his preference.")
{
agreement = itemResponses[i].getResponse();
}
//Here is where I manually edit the way the form displays in the discord channel
//You can edit this however you want
//Don't forget to use + to add variables
//Use "\n" to create a new line
}
channelMsg = {
content: "",
embeds: [{
color: 13056,
title: "**New Video Editor Application** ::movie_camera:",
url: "",
description: "New Video Editor Application.",
fields: [{
name: "**Submitted by:**",
value: discordname,
},
{
name: "**About yourself:**",
value: aboutme,
},
{
name: "**Editing Software:**",
value: software,
},
{
name: "Experience:",
value: experience,
},
{
name: "Portfolio:",
value: portfolio,
},
{
name: "Referral Method:",
value: advertisement,
},
{
name: "Availability:",
value: availability,
},
{
name: "Agreement:",
value: agreement,
}],
timestamp: new Date(),
footer: {
text: ""
}
}
]};
//Payload that goes in
var payload = JSON.stringify(channelMsg);
//Setting up the parameters
var params = {
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
method: "POST",
payload: payload,
muteHttpExceptions: true
};
//API Call
var response = UrlFetchApp.fetch(discordUrl, params);
//This is stuff that gets logged in your View > Logs, can you comment this out
Logger.log(response.getContentText());
Logger.log(payload);
Logger.log(channelMsg);
}