-
-
Save yagitatsu/1a25581273f5835bd60604f0c86fdd54 to your computer and use it in GitHub Desktop.
2022.07.30時点
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const words = [ | |
'Go', | |
'Swift', | |
'Kotlin', | |
'Flutter', | |
'iOS', | |
'Android' | |
]; | |
function doPost(e){ | |
const params = JSON.parse(e.postData.getDataAsString()); | |
const attachments = params.event.attachments; | |
let test = attachments[0].text.toString(); | |
test = test.replace(/\n/g,"").replace(/.*できること/m,"[できること").replace(/Slack通知設定は.*/m,""); | |
let shouldPost = false; | |
for (let i in words) { | |
if (test.includes(words[i])) { | |
shouldPost = true; | |
} | |
} | |
if (!shouldPost) { | |
return; | |
} | |
// 実際に表示されるメッセージ内容 | |
const contents = `<@{userid}> 確認をお願いしますmm`; | |
const options = { | |
"method" : "post", | |
"contentType" : "application/json", | |
"payload" : JSON.stringify( | |
{ | |
"text" : contents, | |
"thread_ts" : params.event.ts | |
} | |
) | |
}; | |
// 投稿先 | |
UrlFetchApp.fetch("{webhook url}", options); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment