Skip to content

Instantly share code, notes, and snippets.

@yagitatsu
Last active July 30, 2022 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yagitatsu/1a25581273f5835bd60604f0c86fdd54 to your computer and use it in GitHub Desktop.
Save yagitatsu/1a25581273f5835bd60604f0c86fdd54 to your computer and use it in GitHub Desktop.
2022.07.30時点
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