mirror of
https://github.com/UiO-Gaming/drift.git
synced 2026-11-05 13:56:46 +01:00
replace gmail pings with role pings
This commit is contained in:
1 file changed
+9
-8
@@ -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",
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user