Professional Documents
Culture Documents
['https://discord.com/api/webhooks/1009393465211240478/uPAguAHflMrWlByAXGXcfnXCUrxZ
TpWZSctjenRcmlmpdSz3dBIL8UwMPp3QhYDuihFV'];
const bonusFeatures = {
convert2Link: 'ON', // Links in embeds will be clickable | Text links won't
embed.
convert2Mention: 'ON' // Checks if there's a Discord ID, and converts it into a
mention.
}
// This loops through our latest response and fetches the Question titles/answers;
then stores them in the items array above.
for (var i = 0; i < response.length; i++) {
const question = response[i].getItem().getTitle(), answer =
response[i].getResponse();
if (answer == "") continue;
items.push({ "name": question, "value": answer });
function data(item) {
const linkValidate = /(?:(?:https?|http?):\/\/)(?:\([-A-Z0-9+&@#\/%=~_|
$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-
9+&@#\/%=~_|$])/i;
function plainText(e) {
// We now loop through our webhooks and send them one by one to the respectful
channels.
for (var i = 0; i < webhooks.length; i++) { UrlFetchApp.fetch(webhooks[i],
text); };
}
function embedText(e) {
// A webhook embed construct, which sets up the correct formatting for sending
to Discord.
const embed = {
"method": "post",
"headers": { "Content-Type": "application/json" },
"muteHttpExceptions": true,
"payload": JSON.stringify({
"content": mention ? mention : '',
"embeds": [{
"title": title ? title : form.getTitle(), // Either the set title
or the forms title.
"description": shortDescription ? `${shortDescription}\n\n$
{items.map(data).join('\n\n')}` : items.map(data).join('\n\n'), // Either the desc
or just the res.
"thumbnail": { url: avatarImage ? encodeURI(avatarImage) :
null }, // The tiny image in the right of the embed
"color": colour ? parseInt(colour.substr(1), 16) :
Math.floor(Math.random() * 16777215), // Either the set colour or random.
"timestamp": new Date().toISOString() // Today's date.
}]
}),
};
// We now loop through our webhooks and send them one by one to the respectful
channels.
for (var i = 0; i < webhooks.length; i++) { UrlFetchApp.fetch(webhooks[i],
embed); };
}