I have a script on a google form that sends answers fro specific questions to a discord channel.
What i cant get to work is for it to notify a specific role in discord that the message has been added to the channel.
I have put the role ID between a <@ and a > but the role or person does not show up on in the discord channel so they are not notified by being @.
function postFeedbackToDiscord()
{
//user mention : <@747564883133857792>
// Load the form and it's responses
var form = FormApp.getActiveForm();
var formResponses = form.getResponses();
var newResponse = formResponses[formResponses.length-1]; // Get the last (newest) response
var itemResponses = newResponse.getItemResponses();
// Get the question responses that you want to include in the Discord message
// In this case, I want the first 3 question responses
var q1 = itemResponses[0].getResponse();
var q2 = itemResponses[1].getResponse();
var q3 = itemResponses[2].getResponse();
var q4 = itemResponses[3].getResponse();
var q7 = itemResponses[22].getResponse();
var q8 = itemResponses[23].getResponse();
var q9 = itemResponses[24].getResponse();
var q20 = itemResponses[25].getResponse();
var q21 = itemResponses[26].getResponse();
var q22 = itemResponses[27].getResponse();
var q24 = itemResponses[29].getResponse();
var fields = [
{
name: "__q1__",
value: trainername.toString()
},
{
name: "__q2__ ",
value: trainerperm.toString()
},
{
name: "__q3__",
value: traineename.toString()
},
{
name: "__q4__",
value: traineeperm.toString()
},
{
name: "__q7__",
value: Citysmallarms.toString()
},
{
name: "__q8__",
value: junctiondelperro.toString()
},
{
name: "__q9__",
value: wheretoland.toString()
},
{
name: "__q20__",
value: whoflyec135.toString()
},
{
name: "__q21__",
value: howgoodfly.toString()
},
{
name: "__q22__",
value: passorfail.toString()
},
{
name: "__q24__",
value: feedtostudent.toString()
}
]
// Set the color to Red if the feedback is reporting an Issue / Bug
// Otherwise, set it to green
var statusColor = (passorfail.toString() == "Issue / Bug") ? 15605837 : 1879160
// Construct the embeded message
var embededMessage = {
color: statusColor,
fields: fields
};
// Construct the post request
var url = "webhook addres here";
var payload = JSON.stringify({embeds: [embededMessage]});
var params = {
headers: {"Content-Type": "application/json"},
method: "POST",
payload: payload,
muteHttpExceptions: true
};
// Send the post request to the Discord webhook
var res = UrlFetchApp.fetch(url, params);
// Log the response
Logger.log(res.getContentText());
}
Please could someone help me with specifics to add to my script to get the @role or @name notified in my discord channel,