✨ Discordロールをプロフィール値に基づいて動的に付与・作成する - #228
Closed
Tivo0921 wants to merge 2 commits into
Closed
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Deployed on https://dev-pr-228-birbz3fm6q-an.a.run.app |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Deployed on https://dev-pr-228-birbz3fm6q-an.a.run.app |
Member
|
興味分野までロール作ってしまうとロールが溢れてしまう気がしていて、
これだけでいいかなと思ったんだけどどう? |
Member
|
#229 とかぶっているためCloseします |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
メンバーのプロフィール(メンバー種別・学年・学部・興味分野)に基づいて Discord
ロールを自動付与する機能を追加。Discord サーバーに対応するロールが存在しない場合は自動作成する。
変更内容
lib/discord-role.ts(新規)— ギルドロール取得・作成・付与のコアロジックlib/admin/actions.ts—syncAllMemberDiscordRoles()で一括付与、詳細結果を返すよう拡張components/admin/role-sync-panel.tsx(新規)—管理者ページのUI、メンバーごとの結果テーブル表示
app/api/onboarding/route.ts— オンボーディング完了時にプロフィール値を渡してロール付与ロールマッチングの仕組み
env var で ID を手動設定する代わりに、Discord
ロール名とプロフィール値を直接マッチングする。ロールが存在しない場合は Bot が自動作成する。
学部生/院生/卒業生/その他学部3年/修士1年…理工学部/教育学部…Python/React…本番環境への適用前に確認すべき点
必須設定
DISCORD_GUILD_IDを Lumos 本番サーバーの ID に設定(現在はテスト用Lusyサーバーを向いている)
Bot の権限確認
のロールが付与対象ロールより上位にあること(下位ロールは付与できない)
運用上の注意
行する前に作成されるロール名(学部名・興味分野タグ等)を確認・整理しておくことを推奨
MEMBER_ROLE_ID環境変数で指定する(任意)
テスト
ロールが自動作成され付与されることを確認