replace gmail pings with role pings

This commit is contained in:
LBlend committed 2022-03-17 22:46:43 +01:00
1 parent 7d09fcb0b8
commit d587316a77
1 file changed
+9 -8
+9 -8
View File
@@ -2,7 +2,7 @@
Iterates through all emails labeled with "Send til Discord" and sends a message to discord through discord webhooks
*/
var webhookUrl = 'yeet'; // Insert your webhook url here
var webhookUrl = "yeet"; // Insert your webhook url here
function processEmails() {
var label = GmailApp.getUserLabelByName("Send til Discord");
@@ -10,7 +10,7 @@ function processEmails() {
for (var i = threads.length - 1; i >= 0; i--) {
var messages = threads[i].getMessages();
var sender = messages[messages.length-1].getFrom();
var sender = messages[messages.length - 1].getFrom();
sendToDiscord(sender);
threads[i].removeLabel(label).refresh();
}
@@ -18,11 +18,12 @@ function processEmails() {
function sendToDiscord(sender) {
var discordPayload = {
content: '<@267415183931080715> <@170506717140877312> Ny e-post fra: ' + sender
}
UrlFetchApp.fetch(webhookUrl', {
method: 'post',
content:
"<@&761538649786417152> <@&761538899289833472> Ny e-post fra: " + sender,
};
UrlFetchApp.fetch(webhookUrl, {
method: "post",
payload: JSON.stringify(discordPayload),
contentType: 'application/json'
})
contentType: "application/json",
});
}