From cc60b9791cccf66f46861de68461ec3f216f6dda Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Thu, 3 Oct 2024 14:21:27 +0000 Subject: [PATCH 01/30] Install dev container --- .devcontainer/.env.example | 1 + .devcontainer/compose.yaml | 18 ++++++++++++++++++ .devcontainer/devcontainer.json | 23 +++++++++++++++++++++++ .devcontainer/slackbot/Dockerfile | 7 +++++++ .devcontainer/tunnel/Dockerfile | 10 ++++++++++ 5 files changed, 59 insertions(+) create mode 100644 .devcontainer/.env.example create mode 100644 .devcontainer/compose.yaml create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/slackbot/Dockerfile create mode 100644 .devcontainer/tunnel/Dockerfile diff --git a/.devcontainer/.env.example b/.devcontainer/.env.example new file mode 100644 index 00000000..b1b400db --- /dev/null +++ b/.devcontainer/.env.example @@ -0,0 +1 @@ +GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ No newline at end of file diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml new file mode 100644 index 00000000..f07a4ba4 --- /dev/null +++ b/.devcontainer/compose.yaml @@ -0,0 +1,18 @@ +services: + slackbot: + build: slackbot + volumes: + - ..:/code + stdin_open: true + tty: true + command: sh -c "npm install && npm run dev -- --only better-custom-response" + + tunnel: + build: + context: tunnel + dockerfile: Dockerfile + args: + - GITHUB_TOKEN=${GITHUB_TOKEN} + stdin_open: true + tty: true + command: node index.mjs --remote wss://slackbot-api.tsg.ne.jp/wsfwd --host slackbot diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..f0a9c95b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,23 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node +{ + "name": "Node.js", + "dockerComposeFile": "compose.yaml", + "service": "slackbot", + "workspaceFolder": "/code" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "yarn install", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile new file mode 100644 index 00000000..a9e8aa3e --- /dev/null +++ b/.devcontainer/slackbot/Dockerfile @@ -0,0 +1,7 @@ +FROM node:20-alpine + +# Install build dependencies for node-canvas +# https://github.com/Automattic/node-canvas/issues/2239#issuecomment-2005970772 +RUN apk update && apk add build-base g++ cairo-dev pango-dev giflib-dev + +WORKDIR /code \ No newline at end of file diff --git a/.devcontainer/tunnel/Dockerfile b/.devcontainer/tunnel/Dockerfile new file mode 100644 index 00000000..d9436e5c --- /dev/null +++ b/.devcontainer/tunnel/Dockerfile @@ -0,0 +1,10 @@ +FROM node:20-alpine +ARG GITHUB_TOKEN + +RUN apk update && \ + apk add git && \ + git clone https://${GITHUB_TOKEN}@github.com/tsg-ut/http-local-fwd.git && \ + cd http-local-fwd/local && \ + npm install + +WORKDIR /http-local-fwd/local From d8bf6d222545c9077f7f25409a51f9c6a66d4568 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Thu, 3 Oct 2024 14:26:15 +0000 Subject: [PATCH 02/30] devcontainer: add Github token secret for http-local-fwd cloning --- .devcontainer/devcontainer.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f0a9c95b..6047c78a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,12 @@ "name": "Node.js", "dockerComposeFile": "compose.yaml", "service": "slackbot", - "workspaceFolder": "/code" + "workspaceFolder": "/code", + "secrets": { + "GITHUB_TOKEN": { + "description": "http-local-fwdをクローンするためのGitHubトークン。repo権限付きの Personal Access Token を使用してください。" + } + } // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, From 2f1efe9d238f57dc332c601fc6292b3a73d26e43 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Thu, 3 Oct 2024 14:43:03 +0000 Subject: [PATCH 03/30] devcontainer: Update GITHUB_TOKEN variable to HTTP_PROXY_TOKEN for better clarity and consistency --- .devcontainer/.env.example | 2 +- .devcontainer/compose.yaml | 2 +- .devcontainer/devcontainer.json | 2 +- .devcontainer/tunnel/Dockerfile | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.devcontainer/.env.example b/.devcontainer/.env.example index b1b400db..f8097bc0 100644 --- a/.devcontainer/.env.example +++ b/.devcontainer/.env.example @@ -1 +1 @@ -GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ No newline at end of file +HTTP_PROXY_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ No newline at end of file diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml index f07a4ba4..95d9007c 100644 --- a/.devcontainer/compose.yaml +++ b/.devcontainer/compose.yaml @@ -12,7 +12,7 @@ services: context: tunnel dockerfile: Dockerfile args: - - GITHUB_TOKEN=${GITHUB_TOKEN} + - HTTP_PROXY_TOKEN=${HTTP_PROXY_TOKEN} stdin_open: true tty: true command: node index.mjs --remote wss://slackbot-api.tsg.ne.jp/wsfwd --host slackbot diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6047c78a..ca728afa 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,7 @@ "service": "slackbot", "workspaceFolder": "/code", "secrets": { - "GITHUB_TOKEN": { + "HTTP_PROXY_TOKEN": { "description": "http-local-fwdをクローンするためのGitHubトークン。repo権限付きの Personal Access Token を使用してください。" } } diff --git a/.devcontainer/tunnel/Dockerfile b/.devcontainer/tunnel/Dockerfile index d9436e5c..ead636f0 100644 --- a/.devcontainer/tunnel/Dockerfile +++ b/.devcontainer/tunnel/Dockerfile @@ -1,9 +1,9 @@ FROM node:20-alpine -ARG GITHUB_TOKEN +ARG HTTP_PROXY_TOKEN RUN apk update && \ apk add git && \ - git clone https://${GITHUB_TOKEN}@github.com/tsg-ut/http-local-fwd.git && \ + git clone https://${HTTP_PROXY_TOKEN}@github.com/tsg-ut/http-local-fwd.git && \ cd http-local-fwd/local && \ npm install From b77848d0287fe4a08042a2237d548dce5c1e0dfb Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Thu, 3 Oct 2024 15:10:54 +0000 Subject: [PATCH 04/30] devcontainer: Add 'runServices' section to specify services to run within the dev container --- .devcontainer/devcontainer.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ca728afa..8da35923 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,7 +9,11 @@ "HTTP_PROXY_TOKEN": { "description": "http-local-fwdをクローンするためのGitHubトークン。repo権限付きの Personal Access Token を使用してください。" } - } + }, + "runServices": [ + "slackbot", + "tunnel" + ] // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, From 3cdde017f6d39ad354bffbce6af81897ad51395c Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Thu, 3 Oct 2024 15:11:32 +0000 Subject: [PATCH 05/30] devcontainer: add git package as a build dependency for node-canvas installation --- .devcontainer/slackbot/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile index a9e8aa3e..1e13a6a5 100644 --- a/.devcontainer/slackbot/Dockerfile +++ b/.devcontainer/slackbot/Dockerfile @@ -2,6 +2,6 @@ FROM node:20-alpine # Install build dependencies for node-canvas # https://github.com/Automattic/node-canvas/issues/2239#issuecomment-2005970772 -RUN apk update && apk add build-base g++ cairo-dev pango-dev giflib-dev +RUN apk update && apk add build-base g++ cairo-dev pango-dev giflib-dev git WORKDIR /code \ No newline at end of file From 1f6c67f3771e2144f58a693921ac481fab889b8f Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sat, 5 Oct 2024 01:48:14 +0900 Subject: [PATCH 06/30] devcontainer: Switch base image from node:20-alpine to mcr.microsoft.com/devcontainers/javascript-node:20 for consistency and additional features --- .devcontainer/slackbot/Dockerfile | 7 ++++--- .devcontainer/tunnel/Dockerfile | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile index 1e13a6a5..2554c068 100644 --- a/.devcontainer/slackbot/Dockerfile +++ b/.devcontainer/slackbot/Dockerfile @@ -1,7 +1,8 @@ -FROM node:20-alpine +FROM mcr.microsoft.com/devcontainers/javascript-node:20 # Install build dependencies for node-canvas -# https://github.com/Automattic/node-canvas/issues/2239#issuecomment-2005970772 -RUN apk update && apk add build-base g++ cairo-dev pango-dev giflib-dev git +# https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems +RUN apt-get update -y && \ + apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev -y WORKDIR /code \ No newline at end of file diff --git a/.devcontainer/tunnel/Dockerfile b/.devcontainer/tunnel/Dockerfile index ead636f0..6744002b 100644 --- a/.devcontainer/tunnel/Dockerfile +++ b/.devcontainer/tunnel/Dockerfile @@ -1,8 +1,7 @@ -FROM node:20-alpine +FROM mcr.microsoft.com/devcontainers/javascript-node:20 ARG HTTP_PROXY_TOKEN -RUN apk update && \ - apk add git && \ +RUN apt-get update -y && \ git clone https://${HTTP_PROXY_TOKEN}@github.com/tsg-ut/http-local-fwd.git && \ cd http-local-fwd/local && \ npm install From f8ca1aaddf63fa236b8a9659d82d6468df5407a2 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sat, 5 Oct 2024 02:09:47 +0900 Subject: [PATCH 07/30] Revert "devcontainer: Switch base image from node:20-alpine to mcr.microsoft.com/devcontainers/javascript-node:20 for consistency and additional features" This reverts commit 75ab8d05ae8c2b0ca3439dce780acf17da34a033. --- .devcontainer/slackbot/Dockerfile | 7 +++---- .devcontainer/tunnel/Dockerfile | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile index 2554c068..1e13a6a5 100644 --- a/.devcontainer/slackbot/Dockerfile +++ b/.devcontainer/slackbot/Dockerfile @@ -1,8 +1,7 @@ -FROM mcr.microsoft.com/devcontainers/javascript-node:20 +FROM node:20-alpine # Install build dependencies for node-canvas -# https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems -RUN apt-get update -y && \ - apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev -y +# https://github.com/Automattic/node-canvas/issues/2239#issuecomment-2005970772 +RUN apk update && apk add build-base g++ cairo-dev pango-dev giflib-dev git WORKDIR /code \ No newline at end of file diff --git a/.devcontainer/tunnel/Dockerfile b/.devcontainer/tunnel/Dockerfile index 6744002b..ead636f0 100644 --- a/.devcontainer/tunnel/Dockerfile +++ b/.devcontainer/tunnel/Dockerfile @@ -1,7 +1,8 @@ -FROM mcr.microsoft.com/devcontainers/javascript-node:20 +FROM node:20-alpine ARG HTTP_PROXY_TOKEN -RUN apt-get update -y && \ +RUN apk update && \ + apk add git && \ git clone https://${HTTP_PROXY_TOKEN}@github.com/tsg-ut/http-local-fwd.git && \ cd http-local-fwd/local && \ npm install From fd9391061afc1302c024f4482823017224649f65 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sat, 5 Oct 2024 02:24:21 +0900 Subject: [PATCH 08/30] devcontainer: add docker-in-docker feature to devcontainer for improved containerization capabilities. --- .devcontainer/devcontainer.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8da35923..9d347e6d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -10,6 +10,11 @@ "description": "http-local-fwdをクローンするためのGitHubトークン。repo権限付きの Personal Access Token を使用してください。" } }, + "features":{ + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "version": "latest" + } + }, "runServices": [ "slackbot", "tunnel" From 9f72eeb00beecbbd984470e96f6c4b7594a4c0d5 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sat, 5 Oct 2024 02:28:55 +0900 Subject: [PATCH 09/30] devcontainer: switch from using docker-in-docker feature to docker-outside-of-docker to improve container performance. --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9d347e6d..56959e97 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,7 +11,7 @@ } }, "features":{ - "ghcr.io/devcontainers/features/docker-in-docker:2": { + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { "version": "latest" } }, From ba013536cf5de3cc486a17205a20a2ddb82446c1 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sat, 5 Oct 2024 02:31:39 +0900 Subject: [PATCH 10/30] devcontainer: update Dockerfile to install git and bash using 'apt' package manager for compatibility --- .devcontainer/slackbot/Dockerfile | 3 ++- .devcontainer/tunnel/Dockerfile | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile index 1e13a6a5..bbe0d364 100644 --- a/.devcontainer/slackbot/Dockerfile +++ b/.devcontainer/slackbot/Dockerfile @@ -2,6 +2,7 @@ FROM node:20-alpine # Install build dependencies for node-canvas # https://github.com/Automattic/node-canvas/issues/2239#issuecomment-2005970772 -RUN apk update && apk add build-base g++ cairo-dev pango-dev giflib-dev git +RUN apk update && apk add build-base g++ cairo-dev pango-dev giflib-dev && \ + apt add git bash WORKDIR /code \ No newline at end of file diff --git a/.devcontainer/tunnel/Dockerfile b/.devcontainer/tunnel/Dockerfile index ead636f0..f5476ad3 100644 --- a/.devcontainer/tunnel/Dockerfile +++ b/.devcontainer/tunnel/Dockerfile @@ -2,7 +2,7 @@ FROM node:20-alpine ARG HTTP_PROXY_TOKEN RUN apk update && \ - apk add git && \ + apk add git bash && \ git clone https://${HTTP_PROXY_TOKEN}@github.com/tsg-ut/http-local-fwd.git && \ cd http-local-fwd/local && \ npm install From 54e281529c2133804fc5f6bf71a1509a621a5885 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sat, 5 Oct 2024 02:33:16 +0900 Subject: [PATCH 11/30] devcontainer: fix package manager command to install git and bash in alpine image with 'apk' instead of 'apt' --- .devcontainer/slackbot/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile index bbe0d364..33821baf 100644 --- a/.devcontainer/slackbot/Dockerfile +++ b/.devcontainer/slackbot/Dockerfile @@ -3,6 +3,6 @@ FROM node:20-alpine # Install build dependencies for node-canvas # https://github.com/Automattic/node-canvas/issues/2239#issuecomment-2005970772 RUN apk update && apk add build-base g++ cairo-dev pango-dev giflib-dev && \ - apt add git bash + apk add git bash WORKDIR /code \ No newline at end of file From 3478d6de81f696ea75324059a3a6b7fe74de7320 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sat, 5 Oct 2024 02:39:40 +0900 Subject: [PATCH 12/30] devcontainer: Update base image from node:20-alpine to node:20-bookworm for slackbot and tunnel devcontainer setups --- .devcontainer/slackbot/Dockerfile | 9 +++++---- .devcontainer/tunnel/Dockerfile | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile index 33821baf..0681ce74 100644 --- a/.devcontainer/slackbot/Dockerfile +++ b/.devcontainer/slackbot/Dockerfile @@ -1,8 +1,9 @@ -FROM node:20-alpine +FROM node:20-bookworm # Install build dependencies for node-canvas -# https://github.com/Automattic/node-canvas/issues/2239#issuecomment-2005970772 -RUN apk update && apk add build-base g++ cairo-dev pango-dev giflib-dev && \ - apk add git bash +# https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems +RUN apt-get update -y && \ + apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev -y && \ + apt-get install git bash WORKDIR /code \ No newline at end of file diff --git a/.devcontainer/tunnel/Dockerfile b/.devcontainer/tunnel/Dockerfile index f5476ad3..dcd5d68e 100644 --- a/.devcontainer/tunnel/Dockerfile +++ b/.devcontainer/tunnel/Dockerfile @@ -1,8 +1,8 @@ -FROM node:20-alpine +FROM node:20-bookworm ARG HTTP_PROXY_TOKEN -RUN apk update && \ - apk add git bash && \ +RUN apt-get update -y && \ + apt-get install git bash -y && \ git clone https://${HTTP_PROXY_TOKEN}@github.com/tsg-ut/http-local-fwd.git && \ cd http-local-fwd/local && \ npm install From 944d9a724d17b40cbcd756057fcf0791a3a6e79b Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sat, 5 Oct 2024 11:11:43 +0900 Subject: [PATCH 13/30] devcontainer: add postAttachCommand, onCreateCommand, postStartCommand, postCreateCommand, initializeCommand, and updateContentCommand to provide instructions and guidance for developers when running the dev container. --- .devcontainer/devcontainer.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 56959e97..49a91a7a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,7 +18,13 @@ "runServices": [ "slackbot", "tunnel" - ] + ], + "postAttachCommand": "docker logs slackbot_devcontainer-tunnel-1 && docker attach slackbot_devcontainer-tunnel-1", + "onCreateCommand": "echo 'onCreate: Please run `docker-compose up` to start the services.'", + "postStartCommand": "echo 'postStart: Please run `docker-compose up` to start the services.'", + "postCreateCommand": "echo 'postCreate: Please run `docker-compose up` to start the services.'", + "initializeCommand": "echo 'initialize: Please run `docker-compose up` to start the services.'", + "updateContentCommand": "echo 'updateContent: Please run `docker-compose up` to start the services.'" // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, From 8c92e5e1a799f9048ecdbe8b6c6af112867b540e Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sat, 5 Oct 2024 11:25:58 +0900 Subject: [PATCH 14/30] devcontainer: Add environment variables for team id, signing secret, slack token, slack bot token, sandbox channel, and slack verification token to the dev container compose file. --- .devcontainer/compose.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml index 95d9007c..15e0f8aa 100644 --- a/.devcontainer/compose.yaml +++ b/.devcontainer/compose.yaml @@ -6,6 +6,13 @@ services: stdin_open: true tty: true command: sh -c "npm install && npm run dev -- --only better-custom-response" + environment: + - TEAM_ID=${TEAM_ID} + - SIGNING_SECRET=${SIGNING_SECRET} + - SLACK_TOKEN=${SLACK_TOKEN} + - SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN} + - CHANNEL_SANDBOX=${CHANNEL_SANDBOX} + - SLACK_VERIFICATION_TOKEN=${SLACK_VERIFICATION_TOKEN} tunnel: build: From b076f1f796d6a9aba57b780aac3102bd880a4e68 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sat, 5 Oct 2024 11:50:26 +0900 Subject: [PATCH 15/30] devcontainer: modify Dockerfile to create necessary directories, link node_modules, and install dependencies correctly for slackbot module --- .devcontainer/compose.yaml | 2 +- .devcontainer/slackbot/Dockerfile | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml index 15e0f8aa..83629021 100644 --- a/.devcontainer/compose.yaml +++ b/.devcontainer/compose.yaml @@ -5,7 +5,7 @@ services: - ..:/code stdin_open: true tty: true - command: sh -c "npm install && npm run dev -- --only better-custom-response" + command: npm run dev -- --only better-custom-response environment: - TEAM_ID=${TEAM_ID} - SIGNING_SECRET=${SIGNING_SECRET} diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile index 0681ce74..1669b8f0 100644 --- a/.devcontainer/slackbot/Dockerfile +++ b/.devcontainer/slackbot/Dockerfile @@ -4,6 +4,13 @@ FROM node:20-bookworm # https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems RUN apt-get update -y && \ apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev -y && \ - apt-get install git bash + apt-get install git bash && \ + mkdir /code && \ + mkdir -p ~/.cache/slackbot/node_modules && \ + cd /code && \ + ln -s ~/.cache/slackbot/node_modules node_modules && \ + wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/package.json && \ + wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/package-lock.json && \ + npm install WORKDIR /code \ No newline at end of file From 5f08561e2f7d30204f3498c18f65453191a7e37f Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sat, 5 Oct 2024 11:50:45 +0900 Subject: [PATCH 16/30] devcontainer: update onCreateCommand to remove existing node_modules and create a symbolic link to a cached version in ~/.cache/slackbot/node_modules, improving development environment setup. --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 49a91a7a..8c2242bf 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -20,7 +20,7 @@ "tunnel" ], "postAttachCommand": "docker logs slackbot_devcontainer-tunnel-1 && docker attach slackbot_devcontainer-tunnel-1", - "onCreateCommand": "echo 'onCreate: Please run `docker-compose up` to start the services.'", + "onCreateCommand": "rm -rf node_modules && ln -s ~/.cache/slackbot/node_modules node_modules", "postStartCommand": "echo 'postStart: Please run `docker-compose up` to start the services.'", "postCreateCommand": "echo 'postCreate: Please run `docker-compose up` to start the services.'", "initializeCommand": "echo 'initialize: Please run `docker-compose up` to start the services.'", From 5c1d02c849c43089d284ffce2d294945f05ed5b2 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sun, 6 Oct 2024 14:11:31 +0900 Subject: [PATCH 17/30] devcontainer: adjust setup process to create a separate node_modules directory for functions and install dependencies individually --- .devcontainer/devcontainer.json | 2 +- .devcontainer/slackbot/Dockerfile | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8c2242bf..f59c48de 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -20,7 +20,7 @@ "tunnel" ], "postAttachCommand": "docker logs slackbot_devcontainer-tunnel-1 && docker attach slackbot_devcontainer-tunnel-1", - "onCreateCommand": "rm -rf node_modules && ln -s ~/.cache/slackbot/node_modules node_modules", + "onCreateCommand": "cp -RTf ~/.cache/slackbot/node_modules /code/node_modules && cp -RTf ~/.cache/slackbot-functions/node_modules /code/functions/node_modules && npm install", "postStartCommand": "echo 'postStart: Please run `docker-compose up` to start the services.'", "postCreateCommand": "echo 'postCreate: Please run `docker-compose up` to start the services.'", "initializeCommand": "echo 'initialize: Please run `docker-compose up` to start the services.'", diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile index 1669b8f0..ce31f8b8 100644 --- a/.devcontainer/slackbot/Dockerfile +++ b/.devcontainer/slackbot/Dockerfile @@ -5,12 +5,19 @@ FROM node:20-bookworm RUN apt-get update -y && \ apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev -y && \ apt-get install git bash && \ - mkdir /code && \ + mkdir -p /code/functions && \ mkdir -p ~/.cache/slackbot/node_modules && \ + mkdir -p ~/.cache/slackbot-functions/node_modules && \ cd /code && \ ln -s ~/.cache/slackbot/node_modules node_modules && \ + ln -s ~/.cache/slackbot-functions/node_modules functions/node_modules && \ wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/package.json && \ wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/package-lock.json && \ - npm install + wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/functions/package.json -O functions/package.json && \ + wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/functions/package-lock.json -O functions/package-lock.json && \ + npm install --ignore-scripts && \ + npm install --ignore-scripts --prefix functions && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* WORKDIR /code \ No newline at end of file From 161b812fd82dd737bb294b2af4b4ebdca9a25f88 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sun, 6 Oct 2024 14:14:44 +0900 Subject: [PATCH 18/30] devcontainer: Update Dockerfile to include the flag -y when installing git and bash to ensure non-interactive installation. --- .devcontainer/slackbot/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile index ce31f8b8..7ce21844 100644 --- a/.devcontainer/slackbot/Dockerfile +++ b/.devcontainer/slackbot/Dockerfile @@ -4,7 +4,7 @@ FROM node:20-bookworm # https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems RUN apt-get update -y && \ apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev -y && \ - apt-get install git bash && \ + apt-get install git bash -y && \ mkdir -p /code/functions && \ mkdir -p ~/.cache/slackbot/node_modules && \ mkdir -p ~/.cache/slackbot-functions/node_modules && \ From 566c3aa5bff6ab7c860f5a8220d80a723fefd715 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sun, 6 Oct 2024 14:32:18 +0900 Subject: [PATCH 19/30] devcontainer: update SLACK_BOT_TOKEN to HAKATASHI_TOKEN in compose.yaml for consistency and clarity --- .devcontainer/compose.yaml | 2 +- .devcontainer/slackbot/Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml index 83629021..7f92e255 100644 --- a/.devcontainer/compose.yaml +++ b/.devcontainer/compose.yaml @@ -10,7 +10,7 @@ services: - TEAM_ID=${TEAM_ID} - SIGNING_SECRET=${SIGNING_SECRET} - SLACK_TOKEN=${SLACK_TOKEN} - - SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN} + - HAKATASHI_TOKEN=${HAKATASHI_TOKEN} - CHANNEL_SANDBOX=${CHANNEL_SANDBOX} - SLACK_VERIFICATION_TOKEN=${SLACK_VERIFICATION_TOKEN} diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile index 7ce21844..b38d7ae1 100644 --- a/.devcontainer/slackbot/Dockerfile +++ b/.devcontainer/slackbot/Dockerfile @@ -1,8 +1,8 @@ FROM node:20-bookworm -# Install build dependencies for node-canvas -# https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems RUN apt-get update -y && \ + # Install build dependencies for node-canvas + # https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev -y && \ apt-get install git bash -y && \ mkdir -p /code/functions && \ From 7293c30bb77d67411456ba312a5bb8534c588bd2 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Mon, 7 Oct 2024 22:22:18 +0000 Subject: [PATCH 20/30] devcontainer: Update onCreateCommand to provide clearer instructions for starting services --- .devcontainer/devcontainer.json | 2 +- .devcontainer/slackbot/Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f59c48de..49a91a7a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -20,7 +20,7 @@ "tunnel" ], "postAttachCommand": "docker logs slackbot_devcontainer-tunnel-1 && docker attach slackbot_devcontainer-tunnel-1", - "onCreateCommand": "cp -RTf ~/.cache/slackbot/node_modules /code/node_modules && cp -RTf ~/.cache/slackbot-functions/node_modules /code/functions/node_modules && npm install", + "onCreateCommand": "echo 'onCreate: Please run `docker-compose up` to start the services.'", "postStartCommand": "echo 'postStart: Please run `docker-compose up` to start the services.'", "postCreateCommand": "echo 'postCreate: Please run `docker-compose up` to start the services.'", "initializeCommand": "echo 'initialize: Please run `docker-compose up` to start the services.'", diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile index b38d7ae1..7ce21844 100644 --- a/.devcontainer/slackbot/Dockerfile +++ b/.devcontainer/slackbot/Dockerfile @@ -1,8 +1,8 @@ FROM node:20-bookworm +# Install build dependencies for node-canvas +# https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems RUN apt-get update -y && \ - # Install build dependencies for node-canvas - # https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev -y && \ apt-get install git bash -y && \ mkdir -p /code/functions && \ From 1963c475c63b0ac9b95e67785ca1dcfccdcf758f Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Mon, 7 Oct 2024 22:25:37 +0000 Subject: [PATCH 21/30] devcontainer: Update docker-compose command in compose.yaml to install dependencies before running dev command --- .devcontainer/compose.yaml | 2 +- .devcontainer/devcontainer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml index 7f92e255..72688f87 100644 --- a/.devcontainer/compose.yaml +++ b/.devcontainer/compose.yaml @@ -5,7 +5,7 @@ services: - ..:/code stdin_open: true tty: true - command: npm run dev -- --only better-custom-response + command: sh -c "npm install && npm run dev -- --only better-custom-response" environment: - TEAM_ID=${TEAM_ID} - SIGNING_SECRET=${SIGNING_SECRET} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 49a91a7a..9db5a386 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -20,7 +20,7 @@ "tunnel" ], "postAttachCommand": "docker logs slackbot_devcontainer-tunnel-1 && docker attach slackbot_devcontainer-tunnel-1", - "onCreateCommand": "echo 'onCreate: Please run `docker-compose up` to start the services.'", + "onCreateCommand": "cp -RTf ~/.cache/slackbot/node_modules /code/node_modules && cp -RTf ~/.cache/slackbot-functions/node_modules /code/functions/node_modules", "postStartCommand": "echo 'postStart: Please run `docker-compose up` to start the services.'", "postCreateCommand": "echo 'postCreate: Please run `docker-compose up` to start the services.'", "initializeCommand": "echo 'initialize: Please run `docker-compose up` to start the services.'", From 4493484b2631e4a7d9c36a6f1c2265c287eedb02 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Tue, 8 Oct 2024 13:26:44 +0000 Subject: [PATCH 22/30] Add common-utils feature to devcontainer.json with zsh shell, slackbot user, and upgraded packages, for improved development environment. --- .devcontainer/compose.yaml | 2 +- .devcontainer/devcontainer.json | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml index 72688f87..add20365 100644 --- a/.devcontainer/compose.yaml +++ b/.devcontainer/compose.yaml @@ -5,7 +5,7 @@ services: - ..:/code stdin_open: true tty: true - command: sh -c "npm install && npm run dev -- --only better-custom-response" + command: sh -c "echo hoge" environment: - TEAM_ID=${TEAM_ID} - SIGNING_SECRET=${SIGNING_SECRET} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9db5a386..ee442039 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,6 +13,13 @@ "features":{ "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { "version": "latest" + }, + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "true", + "username": "slackbot", + "userUid": "1000", + "userGid": "1000", + "upgradePackages": "true" } }, "runServices": [ From db9dfe3151d37746350a55ef65015c0fceada215 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Tue, 8 Oct 2024 20:54:20 +0000 Subject: [PATCH 23/30] devcontainer: Update volumes to include /code/node_modules and /code/functions/node_modules to ensure dependencies are available in the container --- .devcontainer/compose.yaml | 4 +++- .devcontainer/devcontainer.json | 16 ---------------- .devcontainer/slackbot/Dockerfile | 11 ++--------- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml index add20365..2543a97a 100644 --- a/.devcontainer/compose.yaml +++ b/.devcontainer/compose.yaml @@ -3,9 +3,11 @@ services: build: slackbot volumes: - ..:/code + - /code/node_modules + - /code/functions/node_modules stdin_open: true tty: true - command: sh -c "echo hoge" + command: sleep infinity environment: - TEAM_ID=${TEAM_ID} - SIGNING_SECRET=${SIGNING_SECRET} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ee442039..4dede5ba 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,8 +17,6 @@ "ghcr.io/devcontainers/features/common-utils:2": { "installZsh": "true", "username": "slackbot", - "userUid": "1000", - "userGid": "1000", "upgradePackages": "true" } }, @@ -27,24 +25,10 @@ "tunnel" ], "postAttachCommand": "docker logs slackbot_devcontainer-tunnel-1 && docker attach slackbot_devcontainer-tunnel-1", - "onCreateCommand": "cp -RTf ~/.cache/slackbot/node_modules /code/node_modules && cp -RTf ~/.cache/slackbot-functions/node_modules /code/functions/node_modules", - "postStartCommand": "echo 'postStart: Please run `docker-compose up` to start the services.'", - "postCreateCommand": "echo 'postCreate: Please run `docker-compose up` to start the services.'", - "initializeCommand": "echo 'initialize: Please run `docker-compose up` to start the services.'", - "updateContentCommand": "echo 'updateContent: Please run `docker-compose up` to start the services.'" - - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "yarn install", - // Configure tool-specific properties. // "customizations": {}, - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" } diff --git a/.devcontainer/slackbot/Dockerfile b/.devcontainer/slackbot/Dockerfile index 7ce21844..fb4c0cd6 100644 --- a/.devcontainer/slackbot/Dockerfile +++ b/.devcontainer/slackbot/Dockerfile @@ -5,18 +5,11 @@ FROM node:20-bookworm RUN apt-get update -y && \ apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev -y && \ apt-get install git bash -y && \ - mkdir -p /code/functions && \ mkdir -p ~/.cache/slackbot/node_modules && \ mkdir -p ~/.cache/slackbot-functions/node_modules && \ + git clone https://github.com/tsg-ut/slackbot.git --branch master --single-branch --recursive --depth 1 /code && \ cd /code && \ - ln -s ~/.cache/slackbot/node_modules node_modules && \ - ln -s ~/.cache/slackbot-functions/node_modules functions/node_modules && \ - wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/package.json && \ - wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/package-lock.json && \ - wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/functions/package.json -O functions/package.json && \ - wget https://github.com/tsg-ut/slackbot/raw/refs/heads/master/functions/package-lock.json -O functions/package-lock.json && \ - npm install --ignore-scripts && \ - npm install --ignore-scripts --prefix functions && \ + npm install && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* From a8a0c21a353ac22e451b1f6c6ec5fc1c576f6fbb Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Tue, 8 Oct 2024 21:10:31 +0000 Subject: [PATCH 24/30] devcontainer: Add launch configuration for Node.js to start Slackbot with customizable BOT type via promptString input --- .devcontainer/devcontainer.json | 17 +++++++++++------ .vscode/launch.json | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4dede5ba..62d411e0 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -25,10 +25,15 @@ "tunnel" ], "postAttachCommand": "docker logs slackbot_devcontainer-tunnel-1 && docker attach slackbot_devcontainer-tunnel-1", - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Configure tool-specific properties. - // "customizations": {}, + "customizations": { + "vscode": { + "settings": { + "files.autoSave": "off", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + } + } + } + } } diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..71864362 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Slackbot起動", + "skipFiles": [ + "/**" + ], + "runtimeExecutable": "npm", + "runtimeArgs": [ + "run-script", "dev", "--", "--only", "${input:onlyArgument}" + ] + } + ], + "inputs": [ + { + "id": "onlyArgument", + "type": "promptString", + "description": "起動するBOTの種類", + "default": "helloworld" + } + ] +} \ No newline at end of file From a07f6922ea440e34c5fd279459d1da0a6403cd6d Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Tue, 8 Oct 2024 21:12:55 +0000 Subject: [PATCH 25/30] helloworld: Add condition to check if the latest message was posted less than 60 minutes ago before posting a new message --- helloworld/HelloWorld.ts | 9 +++++++++ helloworld/views/helloWorldMessage.ts | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/helloworld/HelloWorld.ts b/helloworld/HelloWorld.ts index 092fb0ae..feb1ae49 100644 --- a/helloworld/HelloWorld.ts +++ b/helloworld/HelloWorld.ts @@ -110,6 +110,15 @@ export class HelloWorld { // 「Hello, World!」メッセージを#sandboxに送信する async postHelloWorld() { + if (this.#state.latestStatusMessage.channel === this.#SANDBOX_ID) { + const timestamp = new Date(parseInt(this.#state.latestStatusMessage.ts) * 1000); + const elapsed = (Date.now() - timestamp.getTime()) / 1000; + if (elapsed < 60 * 60) { + log.info('Skipping postHelloWorld because the latest message was posted less than 60 minutes ago'); + return; + } + } + const result = await this.#slack.chat.postMessage({ username: this.username, channel: process.env.CHANNEL_SANDBOX, diff --git a/helloworld/views/helloWorldMessage.ts b/helloworld/views/helloWorldMessage.ts index f6d54abc..17be0cd5 100644 --- a/helloworld/views/helloWorldMessage.ts +++ b/helloworld/views/helloWorldMessage.ts @@ -54,7 +54,7 @@ export default (state: StateObj): KnownBlock[] => [ elements: [ { type: 'plain_text', - text: '⚠この値は再起動後も保存されますが、再起動前に投稿されたメッセージの数字は更新されなくなります。ボタンを押すとエラーが出る場合は、「Slackbotを作ろう」ページの「WebSocketトンネルをセットアップする」などを参考に Event API のセットアップが正常にできているかもう一度確認してください。', + text: '⚠この値は再起動後も保存されます。前回このメッセージを投稿してから60分以上経っている場合はメッセージが再投稿されますが、以前のメッセージの数字は更新されなくなります。ボタンを押すとエラーが出る場合は、「Slackbotを作ろう」ページの「WebSocketトンネルをセットアップする」などを参考に Event API のセットアップが正常にできているかもう一度確認してください。', emoji: true, }, ], From 7a1959d9500c47b7ae801484c5584a08050a3120 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Wed, 9 Oct 2024 08:18:17 +0000 Subject: [PATCH 26/30] helloworld: Fix tests --- .vscode/launch.json | 38 +++++++++++++++++++++++++++++++---- helloworld/HelloWorld.test.ts | 2 +- helloworld/HelloWorld.ts | 22 ++++++++++---------- 3 files changed, 46 insertions(+), 16 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 71864362..9974379e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,16 +2,40 @@ "version": "0.2.0", "configurations": [ { + "name": "Slackbot起動", "type": "node", + "runtimeExecutable": "npm", + "runtimeArgs": [ + "run-script", + "dev", + "--", + "--only", + "${input:onlyArgument}" + ], "request": "launch", - "name": "Slackbot起動", "skipFiles": [ "/**" ], + "console": "internalConsole", + "outputCapture": "std" + }, + { + "name": "ユニットテストの実行", + "type": "node", "runtimeExecutable": "npm", - "runtimeArgs": [ - "run-script", "dev", "--", "--only", "${input:onlyArgument}" - ] + "args": [ + "run-script", + "test", + "--", + "${input:testFilterArgument}" + ], + "internalConsoleOptions": "openOnSessionStart", + "request": "launch", + "skipFiles": [ + "/**" + ], + "console": "internalConsole", + "outputCapture": "std" } ], "inputs": [ @@ -20,6 +44,12 @@ "type": "promptString", "description": "起動するBOTの種類", "default": "helloworld" + }, + { + "id": "testFilterArgument", + "type": "promptString", + "description": "実行するユニットテストの正規表現フィルタ", + "default": "**/*.{js,ts}" } ] } \ No newline at end of file diff --git a/helloworld/HelloWorld.test.ts b/helloworld/HelloWorld.test.ts index b47774ce..153c17b6 100644 --- a/helloworld/HelloWorld.test.ts +++ b/helloworld/HelloWorld.test.ts @@ -113,7 +113,7 @@ describe('helloworld', () => { elements: [ { type: 'plain_text', - text: '⚠この値は再起動後も保存されますが、再起動前に投稿されたメッセージの数字は更新されなくなります。ボタンを押すとエラーが出る場合は、「Slackbotを作ろう」ページの「WebSocketトンネルをセットアップする」などを参考に Event API のセットアップが正常にできているかもう一度確認してください。', + text: '⚠この値は再起動後も保存されます。前回このメッセージを投稿してから60分以上経っている場合はメッセージが再投稿されますが、以前のメッセージの数字は更新されなくなります。ボタンを押すとエラーが出る場合は、「Slackbotを作ろう」ページの「WebSocketトンネルをセットアップする」などを参考に Event API のセットアップが正常にできているかもう一度確認してください。', emoji: true, }, ], diff --git a/helloworld/HelloWorld.ts b/helloworld/HelloWorld.ts index feb1ae49..4bcd7cce 100644 --- a/helloworld/HelloWorld.ts +++ b/helloworld/HelloWorld.ts @@ -1,13 +1,13 @@ -import {randomUUID} from 'crypto'; +import { randomUUID } from 'crypto'; import type EventEmitter from 'events'; import os from 'os'; -import type {BlockAction, ViewSubmitAction} from '@slack/bolt'; -import type {SlackMessageAdapter} from '@slack/interactive-messages'; -import type {MessageEvent, WebClient} from '@slack/web-api'; -import {Mutex} from 'async-mutex'; +import type { BlockAction, ViewSubmitAction } from '@slack/bolt'; +import type { SlackMessageAdapter } from '@slack/interactive-messages'; +import type { MessageEvent, WebClient } from '@slack/web-api'; +import { Mutex } from 'async-mutex'; import logger from '../lib/logger'; -import type {SlackInterface} from '../lib/slack'; -import {extractMessage} from '../lib/slackUtils'; +import type { SlackInterface } from '../lib/slack'; +import { extractMessage } from '../lib/slackUtils'; import State from '../lib/state'; import counterEditDialog from './views/counterEditDialog'; import helloWorldMessage from './views/helloWorldMessage'; @@ -15,12 +15,12 @@ import helloWorldMessage from './views/helloWorldMessage'; export interface StateObj { uuid: string, counter: number, - latestStatusMessage: {ts: string, channel: string} | null, + latestStatusMessage: { ts: string, channel: string } | null, } const mutex = new Mutex(); -const log = logger.child({bot: 'helloworld'}); +const log = logger.child({ bot: 'helloworld' }); export class HelloWorld { #slack: WebClient; @@ -110,7 +110,7 @@ export class HelloWorld { // 「Hello, World!」メッセージを#sandboxに送信する async postHelloWorld() { - if (this.#state.latestStatusMessage.channel === this.#SANDBOX_ID) { + if (this.#state.latestStatusMessage?.channel === this.#SANDBOX_ID) { const timestamp = new Date(parseInt(this.#state.latestStatusMessage.ts) * 1000); const elapsed = (Date.now() - timestamp.getTime()) / 1000; if (elapsed < 60 * 60) { @@ -152,7 +152,7 @@ export class HelloWorld { } // カウンター編集ダイアログを表示する - private async showCounterEditDialog({triggerId}: {triggerId: string}) { + private async showCounterEditDialog({ triggerId }: { triggerId: string }) { log.info('Showing counter edit dialog'); await this.#slack.views.open({ From 9867e7d3087a7b56f8921358ba81bde4a284236d Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Wed, 9 Oct 2024 12:31:43 +0000 Subject: [PATCH 27/30] devcontainer: Remove recommended secrets from devcontainer.json --- .devcontainer/devcontainer.json | 25 ++++++++++++-------- README.md | 4 ++-- helloworld/HelloWorld.ts | 33 +++++++++++++++++---------- helloworld/views/counterEditDialog.ts | 1 + helloworld/views/helloWorldMessage.ts | 2 +- tsconfig.json | 9 +++++--- 6 files changed, 46 insertions(+), 28 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 62d411e0..09bf9445 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,12 +5,7 @@ "dockerComposeFile": "compose.yaml", "service": "slackbot", "workspaceFolder": "/code", - "secrets": { - "HTTP_PROXY_TOKEN": { - "description": "http-local-fwdをクローンするためのGitHubトークン。repo権限付きの Personal Access Token を使用してください。" - } - }, - "features":{ + "features": { "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { "version": "latest" }, @@ -31,9 +26,19 @@ "files.autoSave": "off", "editor.formatOnSave": true, "editor.codeActionsOnSave": { - "source.fixAll.eslint": "explicit" - } - } + "source.fixAll": "always", + "source.fixAll.eslint": "always" + }, + "eslint.format.enable": true + }, + "extensions": [ + "ms-vscode.vscode-typescript-next", + "dbaeumer.vscode-eslint", + "GitHub.copilot", + "GitHub.copilot-chat", + "GitHub.vscode-pull-request-github", + "toba.vsfire" + ] } } -} +} \ No newline at end of file diff --git a/README.md b/README.md index 22251c7d..d34ae8af 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # slackbot +[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=false&ref=master&repo=105612722&skip_quickstart=false) + [![Test][action-image]][action-url] [![Coverage Status][codecov-image]][codecov-url] @@ -13,8 +15,6 @@ TSGのSlackで動くSlackbotたち -自分がOWNERのコードの変更は直接masterにpushして構いません。 ([CODEOWNERS](CODEOWNERS)参照) - ## 環境構築 ### Prerequisites diff --git a/helloworld/HelloWorld.ts b/helloworld/HelloWorld.ts index 4bcd7cce..d2e7fecd 100644 --- a/helloworld/HelloWorld.ts +++ b/helloworld/HelloWorld.ts @@ -1,13 +1,13 @@ -import { randomUUID } from 'crypto'; +import {randomUUID} from 'crypto'; import type EventEmitter from 'events'; import os from 'os'; -import type { BlockAction, ViewSubmitAction } from '@slack/bolt'; -import type { SlackMessageAdapter } from '@slack/interactive-messages'; -import type { MessageEvent, WebClient } from '@slack/web-api'; -import { Mutex } from 'async-mutex'; +import type {BlockAction, ViewSubmitAction} from '@slack/bolt'; +import type {SlackMessageAdapter} from '@slack/interactive-messages'; +import type {MessageEvent, WebClient} from '@slack/web-api'; +import {Mutex} from 'async-mutex'; import logger from '../lib/logger'; -import type { SlackInterface } from '../lib/slack'; -import { extractMessage } from '../lib/slackUtils'; +import type {SlackInterface} from '../lib/slack'; +import {extractMessage} from '../lib/slackUtils'; import State from '../lib/state'; import counterEditDialog from './views/counterEditDialog'; import helloWorldMessage from './views/helloWorldMessage'; @@ -20,7 +20,7 @@ export interface StateObj { const mutex = new Mutex(); -const log = logger.child({ bot: 'helloworld' }); +const log = logger.child({bot: 'helloworld'}); export class HelloWorld { #slack: WebClient; @@ -31,7 +31,7 @@ export class HelloWorld { #state: StateObj; - #SANDBOX_ID = process.env.CHANNEL_SANDBOX!; + #SANDBOX_ID = process.env.CHANNEL_SANDBOX ?? ''; // インスタンスを生成するためのファクトリメソッド static async create(slack: SlackInterface) { @@ -86,7 +86,7 @@ export class HelloWorld { const stateValues = Object.assign({}, ...stateObjects); mutex.runExclusive(() => ( - this.setCounterValue(parseInt(stateValues.counter_input.value)) + this.setCounterValue(parseInt(stateValues.counter_input.value) || 0) )); }); @@ -113,10 +113,19 @@ export class HelloWorld { if (this.#state.latestStatusMessage?.channel === this.#SANDBOX_ID) { const timestamp = new Date(parseInt(this.#state.latestStatusMessage.ts) * 1000); const elapsed = (Date.now() - timestamp.getTime()) / 1000; + + // 直近のメッセージが60分以内に投稿されている場合は何もせず終了 if (elapsed < 60 * 60) { log.info('Skipping postHelloWorld because the latest message was posted less than 60 minutes ago'); return; } + + // 直近のメッセージが60分以上前に投稿されている場合は削除して投稿し直す + log.info('Removing last status message because the latest message was posted more than 60 minutes ago'); + await this.#slack.chat.delete({ + channel: this.#state.latestStatusMessage.channel, + ts: this.#state.latestStatusMessage.ts, + }); } const result = await this.#slack.chat.postMessage({ @@ -138,7 +147,7 @@ export class HelloWorld { this.#state.counter = value; if (!this.#state.latestStatusMessage) { - log.warn('latestStatusMessage is not set'); + log.error('latestStatusMessage is not set'); return; } @@ -152,7 +161,7 @@ export class HelloWorld { } // カウンター編集ダイアログを表示する - private async showCounterEditDialog({ triggerId }: { triggerId: string }) { + private async showCounterEditDialog({triggerId}: { triggerId: string }) { log.info('Showing counter edit dialog'); await this.#slack.views.open({ diff --git a/helloworld/views/counterEditDialog.ts b/helloworld/views/counterEditDialog.ts index c46cb507..d4f41a23 100644 --- a/helloworld/views/counterEditDialog.ts +++ b/helloworld/views/counterEditDialog.ts @@ -22,6 +22,7 @@ export default (state: StateObj): View => ({ action_id: 'counter_input', is_decimal_allowed: false, min_value: '0', + max_value: '10000000000', initial_value: state.counter.toString(), }, label: { diff --git a/helloworld/views/helloWorldMessage.ts b/helloworld/views/helloWorldMessage.ts index 17be0cd5..8209b871 100644 --- a/helloworld/views/helloWorldMessage.ts +++ b/helloworld/views/helloWorldMessage.ts @@ -54,7 +54,7 @@ export default (state: StateObj): KnownBlock[] => [ elements: [ { type: 'plain_text', - text: '⚠この値は再起動後も保存されます。前回このメッセージを投稿してから60分以上経っている場合はメッセージが再投稿されますが、以前のメッセージの数字は更新されなくなります。ボタンを押すとエラーが出る場合は、「Slackbotを作ろう」ページの「WebSocketトンネルをセットアップする」などを参考に Event API のセットアップが正常にできているかもう一度確認してください。', + text: '⚠この値は再起動後も保存されます。前回このメッセージを投稿してから60分以上経っている場合は、以前のメッセージが削除され再投稿されます。ボタンを押すとエラーが出る場合は、「Slackbotを作ろう」ページの「WebSocketトンネルをセットアップする」などを参考に Event API のセットアップが正常にできているかもう一度確認してください。', emoji: true, }, ], diff --git a/tsconfig.json b/tsconfig.json index 0cec7674..46d2188b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,14 +13,17 @@ "./node_modules" ], "compilerOptions": { - "target": "es2015", + "target": "ESNext", "module": "CommonJS", "moduleResolution": "node", "noImplicitAny": true, "resolveJsonModule": true, "esModuleInterop": true, - "lib": ["es2021", "DOM"], + "lib": [ + "ESNext", + "DOM" + ], "skipLibCheck": true, "experimentalDecorators": true } -} +} \ No newline at end of file From 5914e7de820532fff092cfd626b6cf57b683851a Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Wed, 9 Oct 2024 14:13:31 +0000 Subject: [PATCH 28/30] Include environment authority in the username of slack system messages --- .vscode/launch.json | 5 +++-- helloworld/HelloWorld.test.ts | 6 +++--- helloworld/HelloWorld.ts | 7 ++++--- index.ts | 7 ++++--- lib/__mocks__/slackUtils.ts | 8 ++++++-- lib/slackUtils.ts | 38 +++++++++++++++++++++++++---------- package.json | 2 +- 7 files changed, 48 insertions(+), 25 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 9974379e..ca2f6750 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -27,6 +27,7 @@ "run-script", "test", "--", + "--colors", "${input:testFilterArgument}" ], "internalConsoleOptions": "openOnSessionStart", @@ -48,8 +49,8 @@ { "id": "testFilterArgument", "type": "promptString", - "description": "実行するユニットテストの正規表現フィルタ", - "default": "**/*.{js,ts}" + "description": "実行するユニットテストの正規表現フィルタ (全部実行する場合は空文字列を入力)", + "default": "" } ] } \ No newline at end of file diff --git a/helloworld/HelloWorld.test.ts b/helloworld/HelloWorld.test.ts index 153c17b6..f37eec8f 100644 --- a/helloworld/HelloWorld.test.ts +++ b/helloworld/HelloWorld.test.ts @@ -33,7 +33,7 @@ describe('helloworld', () => { it('responds to "Hello"', async () => { const response = await slack.getResponseTo('Hello'); expect(response).toEqual({ - username: 'helloworld [test-hostname]', + username: 'helloworld [TEST_AUTHORITY]', channel: slack.fakeChannel, text: 'World!', }); @@ -59,7 +59,7 @@ describe('helloworld', () => { const mockedPostMessage = slack.webClient.chat.postMessage as jest.MockedFunction; expect(mockedPostMessage).toBeCalledWith({ - username: 'helloworld [test-hostname]', + username: 'helloworld [TEST_AUTHORITY]', channel: slack.fakeChannel, text: 'Hello, World!', blocks: [ @@ -113,7 +113,7 @@ describe('helloworld', () => { elements: [ { type: 'plain_text', - text: '⚠この値は再起動後も保存されます。前回このメッセージを投稿してから60分以上経っている場合はメッセージが再投稿されますが、以前のメッセージの数字は更新されなくなります。ボタンを押すとエラーが出る場合は、「Slackbotを作ろう」ページの「WebSocketトンネルをセットアップする」などを参考に Event API のセットアップが正常にできているかもう一度確認してください。', + text: '⚠この値は再起動後も保存されます。前回このメッセージを投稿してから60分以上経っている場合は、以前のメッセージが削除され再投稿されます。ボタンを押すとエラーが出る場合は、「Slackbotを作ろう」ページの「WebSocketトンネルをセットアップする」などを参考に Event API のセットアップが正常にできているかもう一度確認してください。', emoji: true, }, ], diff --git a/helloworld/HelloWorld.ts b/helloworld/HelloWorld.ts index d2e7fecd..a7404949 100644 --- a/helloworld/HelloWorld.ts +++ b/helloworld/HelloWorld.ts @@ -1,13 +1,12 @@ import {randomUUID} from 'crypto'; import type EventEmitter from 'events'; -import os from 'os'; import type {BlockAction, ViewSubmitAction} from '@slack/bolt'; import type {SlackMessageAdapter} from '@slack/interactive-messages'; import type {MessageEvent, WebClient} from '@slack/web-api'; import {Mutex} from 'async-mutex'; import logger from '../lib/logger'; import type {SlackInterface} from '../lib/slack'; -import {extractMessage} from '../lib/slackUtils'; +import {extractMessage, getAuthorityLabel} from '../lib/slackUtils'; import State from '../lib/state'; import counterEditDialog from './views/counterEditDialog'; import helloWorldMessage from './views/helloWorldMessage'; @@ -33,6 +32,8 @@ export class HelloWorld { #SANDBOX_ID = process.env.CHANNEL_SANDBOX ?? ''; + #AUTHORITY = getAuthorityLabel(); + // インスタンスを生成するためのファクトリメソッド static async create(slack: SlackInterface) { log.info('Creating helloworld bot instance'); @@ -105,7 +106,7 @@ export class HelloWorld { } private get username() { - return `helloworld [${os.hostname()}]`; + return `helloworld [${this.#AUTHORITY}]`; } // 「Hello, World!」メッセージを#sandboxに送信する diff --git a/index.ts b/index.ts index 7a582779..054fff19 100644 --- a/index.ts +++ b/index.ts @@ -7,7 +7,6 @@ import dotenv from 'dotenv'; dotenv.config(); import Fastify from 'fastify'; -import os from 'os'; import qs from 'querystring'; import { eventClient, messageClient, tsgEventClient, webClient } from './lib/slack'; @@ -23,6 +22,7 @@ import { throttle, uniq } from 'lodash'; import { RequestHandler } from 'express-serve-static-core'; import { inspect } from 'util'; import concat from 'concat-stream'; +import { getAuthorityLabel } from './lib/slackUtils'; const log = logger.child({ bot: 'index' }); @@ -187,9 +187,10 @@ eventClient.on('error', (error) => { fastify.use('/slack-message', messageClient.requestListener()); const loadedPlugins = new Set(); + const authority = getAuthorityLabel(); const initializationMessage = await webClient.chat.postMessage({ - username: `tsgbot [${os.hostname()}]`, + username: `tsgbot [${authority}]`, channel: process.env.CHANNEL_SANDBOX, text: `起動中⋯⋯ (${loadedPlugins.size}/${plugins.length})`, attachments: plugins.map((name) => ({ @@ -246,7 +247,7 @@ eventClient.on('error', (error) => { log.info('Launched'); webClient.chat.postMessage({ - username: `tsgbot [${os.hostname()}]`, + username: `tsgbot [${authority}]`, channel: process.env.CHANNEL_SANDBOX, text: argv.startup, }); diff --git a/lib/__mocks__/slackUtils.ts b/lib/__mocks__/slackUtils.ts index 9fb691a8..d0318d02 100644 --- a/lib/__mocks__/slackUtils.ts +++ b/lib/__mocks__/slackUtils.ts @@ -1,6 +1,6 @@ /* eslint-env node, jest */ -import {MrkdwnElement, PlainTextElement} from '@slack/web-api'; -import type {MessageEvent} from '@slack/bolt'; +import { MrkdwnElement, PlainTextElement } from '@slack/web-api'; +import type { MessageEvent } from '@slack/bolt'; export const getMemberName = jest.fn(async () => 'Dummy User'); export const getMemberIcon = jest.fn(async () => 'https://example.com/dummy.png'); @@ -18,4 +18,8 @@ export const mrkdwn = (text: string): MrkdwnElement => ({ export const extractMessage = (message: MessageEvent) => { return message; +}; + +export const getAuthorityLabel = () => { + return 'TEST_AUTHORITY'; }; \ No newline at end of file diff --git a/lib/slackUtils.ts b/lib/slackUtils.ts index 3e683ca2..286f5e9f 100644 --- a/lib/slackUtils.ts +++ b/lib/slackUtils.ts @@ -1,10 +1,11 @@ -import type {MrkdwnElement, PlainTextElement} from '@slack/web-api'; -import type {Member} from '@slack/web-api/dist/types/response/UsersListResponse'; -import {WebClient} from '@slack/web-api'; -import {eventClient, getTokens} from './slack'; -import {Deferred} from './utils'; +import type { MrkdwnElement, PlainTextElement } from '@slack/web-api'; +import type { Member } from '@slack/web-api/dist/types/response/UsersListResponse'; +import { WebClient } from '@slack/web-api'; +import { eventClient, getTokens } from './slack'; +import { Deferred } from './utils'; import SlackCache from './slackCache'; -import type {GenericMessageEvent, MessageEvent} from '@slack/bolt'; +import type { GenericMessageEvent, MessageEvent } from '@slack/bolt'; +import os from 'os'; const slackCaches = new Map(); const initializedSlackCachesDeferred = new Deferred(); @@ -34,11 +35,11 @@ export const getAllTSGMembers = async (): Promise> => { return await slackCaches.get(process.env.TEAM_ID!)!.getUsers(); }; -export const getMemberName = async (user: string): Promise => { +export const getMemberName = async (user: string): Promise => { await initializedSlackCachesDeferred.promise; // TODO: receive team_id and use it to choose slackCache - let member: Member|null = null; + let member: Member | null = null; for (const caches of slackCaches.values()) { const found = await caches.getUser(user); if (found) { @@ -51,11 +52,11 @@ export const getMemberName = async (user: string): Promise => }; type IconResolution = 24 | 32 | 48 | 72 | 192 | 512; -export const getMemberIcon = async (user: string, res: IconResolution = 24): Promise => { +export const getMemberIcon = async (user: string, res: IconResolution = 24): Promise => { await initializedSlackCachesDeferred.promise; // TODO: receive team_id and use it to choose slackCache - let member: Member|null = null; + let member: Member | null = null; for (const caches of slackCaches.values()) { const found = await caches.getUser(user); if (found) { @@ -82,7 +83,7 @@ export const getMemberIcon = async (user: string, res: IconResolution = 24): Pro } }; -export const getEmoji = async (name: string, team: string): Promise => { +export const getEmoji = async (name: string, team: string): Promise => { await initializedSlackCachesDeferred.promise; return slackCaches.get(team)?.getEmoji(name); }; @@ -113,4 +114,19 @@ export const extractMessage = (message: MessageEvent) => { return message.root; } return null; +}; + +export const getAuthorityLabel = () => { + if (process.env.NODE_ENV === 'production') { + return 'production'; + } + + if (process.env.GITHUB_USER && process.env.CODESPACE_NAME) { + const abbreviatedCodespaceName = process.env.CODESPACE_NAME.split('-')[0] + '-…'; + return `Codespaces (@${process.env.GITHUB_USER}): ${abbreviatedCodespaceName}`; + } + + const username = process.env.GITHUB_USER || process.env.USER || process.env.USERNAME || os.userInfo()?.username || 'unknown'; + const hostname = process.env.CODESPACE_NAME || os.hostname() || 'unknown'; + return `${username}@${hostname}`; }; \ No newline at end of file diff --git a/package.json b/package.json index 87a6544a..c6e8a3da 100644 --- a/package.json +++ b/package.json @@ -169,4 +169,4 @@ "ts-jest": "^29.0.0", "ts-node-dev": "^2.0.0" } -} +} \ No newline at end of file From 929a8b9fe48c5684b9981d301d2d2f2a9ec4570a Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Wed, 9 Oct 2024 12:41:40 +0000 Subject: [PATCH 29/30] Include .vscode/launch.json in the repository while still ignoring the rest of the .vscode folder --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f3ada7f2..d15e98b3 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,4 @@ tokens.sqlite3 .DS_Store .vscode +!.vscode/launch.json From c29cfde8216dbd4ada7f046aba61909af44e2b7d Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Wed, 9 Oct 2024 12:44:58 +0000 Subject: [PATCH 30/30] helloworld: Fix formatting issue in StateObj interface to align with project coding standards --- helloworld/HelloWorld.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helloworld/HelloWorld.ts b/helloworld/HelloWorld.ts index a7404949..9a3f7573 100644 --- a/helloworld/HelloWorld.ts +++ b/helloworld/HelloWorld.ts @@ -14,7 +14,7 @@ import helloWorldMessage from './views/helloWorldMessage'; export interface StateObj { uuid: string, counter: number, - latestStatusMessage: { ts: string, channel: string } | null, + latestStatusMessage: {ts: string, channel: string} | null, } const mutex = new Mutex();