-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from su-its/develop
Release v1.0.0
- Loading branch information
Showing
54 changed files
with
3,408 additions
and
27 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/.vscode | ||
/build | ||
/node_modules | ||
/docs | ||
README.md |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/node_modules | ||
/build | ||
.env | ||
its-*.json | ||
/.vscode |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
node_modules/ | ||
out/ | ||
|
||
.eslintrc.json | ||
eslint.config.js | ||
package-lock.json | ||
yarn.lock | ||
src/libs/api/v1.d.ts | ||
.env | ||
its-discord-auth-firebase-adminsdk-wn2uo-ac781d8325.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": false, | ||
"semi": true, | ||
"quoteProps": "as-needed", | ||
"jsxSingleQuote": false, | ||
"trailingComma": "es5", | ||
"bracketSpacing": true, | ||
"bracketSameLine": false, | ||
"arrowParens": "always", | ||
"proseWrap": "preserve", | ||
"endOfLine": "lf", | ||
"embeddedLanguageFormatting": "off", | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# its-discord bot | ||
|
||
ITSのディスコードサーバーで使用するbotです | ||
|
||
# Getting started | ||
|
||
```bash | ||
npm install | ||
npm run dev | ||
``` | ||
|
||
その他詳細は`docs`ディレクトリを参照してください |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# NOTE: latestはお試し | ||
FROM node:latest | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
RUN npm install | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["npm", "run", "dev"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# ディレクトリ戦略 | ||
|
||
本ドキュメントでは、それぞれのディレクトリの役割について説明します | ||
|
||
# commands | ||
|
||
Discord Botに対して実装するコマンドを格納します。 | ||
1コマンドにつき、1ファイルを作成します | ||
|
||
# controllers | ||
|
||
インフラに対するインターフェースを格納します | ||
現時点ではfirebaseに対するインターフェースになっています | ||
|
||
# entities | ||
|
||
インフラで扱うデータの型を定義し、格納します | ||
e.g. Member | ||
|
||
# events | ||
|
||
Discord Botで扱うイベントハンドラをイベントごとに実装し、格納します | ||
実装したイベントは`eventHandler.ts`からクライアントに実装されるべきです | ||
|
||
# infra | ||
|
||
インフラを定義し、格納します | ||
現状では、`firestore`, `firebase-admin`が定義され格納されています | ||
|
||
# roles | ||
|
||
Discord Botで扱う`Role`のプロパティを定義し、格納します | ||
現状では、1ロールに対して1ファイルを作成していますが、屋や冗長に思えるので将来的に廃止される可能性があります | ||
|
||
# types | ||
|
||
プロジェクトで使用する型を定義し格納します | ||
|
||
# usecases | ||
|
||
インフラに対する直接的な操作を実装し、格納します | ||
|
||
# utils | ||
|
||
上記のどこにも属さず、プロジェクト全体で使うような汎用的な機能を実装し、格納します | ||
|
||
# root files | ||
|
||
## deployCommands.ts | ||
|
||
コマンドをDiscord Botに対してデプロイするためのスクリプトです | ||
新たにコマンドを実装した際には、`npm run deploy-commands`を実行してBotにデプロイする必要があります | ||
|
||
## loadCommands.ts | ||
|
||
Botを稼働した際に、`commands`フォルダで実装されているコマンドを全て読み込むためのスクリプトです | ||
個別に実行する必要はありません | ||
|
||
## main.ts | ||
|
||
エントリポイントです。 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 環境変数 | ||
|
||
## .env | ||
|
||
.envファイルには以下の情報を記載して下さい | ||
|
||
```.env | ||
TOKEN= | ||
APP_ID= | ||
GUILD_ID= | ||
FIREBASE_API_KEY= | ||
FIREBASE_AUTH_DOMAIN= | ||
databaseURL= | ||
FIREBASE_PROJECT_ID= | ||
FIREBASE_STORAGE_BUCKET= | ||
FIREBASE_MESSAGING_SENDER_ID= | ||
FIREBASE_APP_ID= | ||
FIREBASE_MESUREMENT_ID= | ||
``` | ||
|
||
## firebase-admin | ||
|
||
firestoreを使用するためにfirestoreから提供されるコンフィグファイルをルートに設置してください | ||
現状`infra/firebase.ts`で読み込んでいますが、分かりにくいので将来的に分離します |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Getting started | ||
|
||
## デバッグ | ||
|
||
``` | ||
npm install | ||
npm run dev | ||
``` | ||
|
||
## コマンドのデプロイ | ||
|
||
``` | ||
npm run deploy-commands | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 認証周りの仕様 | ||
|
||
本ドキュメントでは、認証周りの使用について説明します | ||
|
||
## 基本的なフロー | ||
|
||
1. サーバーに新しくユーザーが参加すると`Unauthorized`ロールを付与 | ||
2. Botが参加したユーザーにDMを送信、氏名、学籍番号、学科、メールアドレスについて尋ねる | ||
3. ユーザーがDMで入力した情報と、firestore内のデータを比較 | ||
4. 氏名、学籍番号、学科、メールアドレスが全て一致するデータが存在した場合のみ認証メールを送信 | ||
5. 認証メールから認証をした状態でユーザーが`/auth`コマンドを実行することで`Unauthorized`ロールを剥奪、`Authorized`ロールを付与 | ||
|
||
## ロールについて | ||
|
||
ロールは存在しなければ勝手に作成するようになっている | ||
|
||
## firebaseの認証について | ||
|
||
認証のためには、アカウントを作成する必要があり、パスワードがrequiredだったのでとりあえず便宜的に`学籍番号+学科`が設定してある | ||
このアカウントを使用してログインすることはないと思うが、必要になったときはDMから受け取るようにするなりしてください | ||
|
||
## /authコマンド | ||
|
||
ユーザーがauthコマンドで認証を確認できるようにするために、DMで情報を受け取ったときにDiscordIdをfirestoreにストアしている |
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
Oops, something went wrong.