Skip to content

Commit

Permalink
[from now] 2024/02/29 20:48:04
Browse files Browse the repository at this point in the history
diff --git a/src/interactions/applicationCommands/mokumokuStart.ts b/src/interactions/applicationCommands/mokumokuStart.ts
new file mode 100644
index 0000000..433a218
--- /dev/null
+++ b/src/interactions/applicationCommands/mokumokuStart.ts
@@ -0,0 +1,23 @@
+import { MOKUMOKU_START_COMMAND_NAME } from "../../constants";
+import { buildMokumokuCommandResponse as buildMokumokuStartCommandResponse } from "../../responses/mokumokuStartCommandResponse";
+
+const handler = async () => {
+  return buildMokumokuStartCommandResponse({ date: "2024/02/29" });
+  /*
+  その他メモ
+  * スタートしたという事実をDBに保存する?
+    * その場合重複で起動した場合はどうする?
+      * 重複起動はハンドリングすればいいか
+    * 使い道が時報の時に参照するくらい?
+      * 事実をDBに保存しなくても当時にcheckinのレコードがある場合はという条件でも良いかもしれない
+        * でもそれもイマイチかもなー。。
+      * checkinをもくもく会に紐づけたいな
+    * mokumoku-startの前にcheckinを実行したら?
+      * そしたらエラーを返せばいいか。先にmokumokou-startをしてくださいと
+  */
+};
+
+export default {
+  commandName: MOKUMOKU_START_COMMAND_NAME,
+  handler,
+};
diff --git a/src/responses/mokumokuStartCommandResponse.ts b/src/responses/mokumokuStartCommandResponse.ts
new file mode 100644
index 0000000..99a161f
--- /dev/null
+++ b/src/responses/mokumokuStartCommandResponse.ts
@@ -0,0 +1,36 @@
+import {
+  APIInteractionResponseChannelMessageWithSource,
+  InteractionResponseType,
+} from "discord-api-types/v10";
+
+export const buildMokumokuCommandResponse = ({
+  date,
+}: {
+  date: string;
+}): APIInteractionResponseChannelMessageWithSource => {
+  return {
+    type: InteractionResponseType.ChannelMessageWithSource,
+    data: {
+      content: `${date}のIbaraki.devを開始します!\n準備ができたら \`/checkin\` コマンドで今日やることを投稿してください!\n\n`,
+      embeds: [
+        {
+          thumbnail: {
+            url: "https://avatars.githubusercontent.com/u/161560614?s=200&v=4",
+          },
+          fields: [
+            {
+              name: "🕗 スケジュール",
+              value:
+                "**`13:00〜13:15`** チェックイン(自己紹介・やること共有)\n**`13:15〜15:00`** もくもく作業\n**`15:00〜15:30`** LT or テックトーク\n**`15:30〜17:50`** もくもく作業\n**`17:50〜18:00`** やったこと共有 & 片付け\n**`18:00〜`**           懇親会(希望者のみ)\n",
+            },
+            {
+              name: "📝 `/checkin` コマンド",
+              value:
+                "投稿欄に `/chekcin` とコマンドを入力してEnterを押すと、モーダルが表示されます。そのモーダルに自己紹介と今日のやることを入力して送信してください。",
+            },
+          ],
+        },
+      ],
+    },
+  };
+};
  • Loading branch information
kawamataryo committed Feb 29, 2024
1 parent 47122b8 commit f512515
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/interactions/applicationCommands/mokumokuStart.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { MOKUMOKU_START_COMMAND_NAME } from "../../constants";
import { buildMokumokuCommandResponse as buildMokumokuStartCommandResponse } from "../../responses/mokumokuStartCommandResponse";

const handler = async () => {
return buildMokumokuStartCommandResponse({ date: "2024/02/29" });
/*
その他メモ
* スタートしたという事実をDBに保存する?
* その場合重複で起動した場合はどうする?
* 重複起動はハンドリングすればいいか
* 使い道が時報の時に参照するくらい?
* 事実をDBに保存しなくても当時にcheckinのレコードがある場合はという条件でも良いかもしれない
* でもそれもイマイチかもなー。。
* checkinをもくもく会に紐づけたいな
* mokumoku-startの前にcheckinを実行したら?
* そしたらエラーを返せばいいか。先にmokumokou-startをしてくださいと
*/
};

export default {
commandName: MOKUMOKU_START_COMMAND_NAME,
handler,
};
36 changes: 36 additions & 0 deletions src/responses/mokumokuStartCommandResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {
APIInteractionResponseChannelMessageWithSource,
InteractionResponseType,
} from "discord-api-types/v10";

export const buildMokumokuCommandResponse = ({
date,
}: {
date: string;
}): APIInteractionResponseChannelMessageWithSource => {
return {
type: InteractionResponseType.ChannelMessageWithSource,
data: {
content: `${date}のIbaraki.devを開始します!\n準備ができたら \`/checkin\` コマンドで今日やることを投稿してください!\n\n`,
embeds: [
{
thumbnail: {
url: "https://avatars.githubusercontent.com/u/161560614?s=200&v=4",
},
fields: [
{
name: "🕗 スケジュール",
value:
"**`13:00〜13:15`** チェックイン(自己紹介・やること共有)\n**`13:15〜15:00`** もくもく作業\n**`15:00〜15:30`** LT or テックトーク\n**`15:30〜17:50`** もくもく作業\n**`17:50〜18:00`** やったこと共有 & 片付け\n**`18:00〜`** 懇親会(希望者のみ)\n",
},
{
name: "📝 `/checkin` コマンド",
value:
"投稿欄に `/chekcin` とコマンドを入力してEnterを押すと、モーダルが表示されます。そのモーダルに自己紹介と今日のやることを入力して送信してください。",
},
],
},
],
},
};
};

0 comments on commit f512515

Please sign in to comment.