feat: add /studies and /members commands with code quality fixes#8
Merged
songkg7 merged 16 commits intoLearning-Is-Vital-In-Development:mainfrom Mar 2, 2026
Merged
Conversation
- Fix nil dereference on i.Member in submit handler (CRITICAL) - Replace log.Fatal with proper error return from bot.Run (CRITICAL) - Add bot self-filter to OnReactionRemove (HIGH) - Roll back Discord message on recruit DB save failure (HIGH) - Add schema_migrations tracking to prevent re-running migrations (HIGH) - Remove dead checkNilErr function
- Remove unnecessary HTTP GET in submit handler (body was unused) - Handle TOCTOU race in ensureCategoryID with retry on create failure - Use index-based access in getOrCreateWritableSlot to avoid stale pointer - Sanitize channel names for Discord rules (lowercase, no special chars, 100 char limit) - Validate required environment variables at startup with clear error messages
Allow any guild member to query the current participants of a study via autocomplete channel selection. The response is ephemeral and shows each member with their join date. Also consolidates duplicate autocomplete responder into shared respondAutocomplete helper in helpers.go.
Close recruitment for a branch, check member counts per study, and either start (>= 3 members) or auto-archive (< 3 members) each study. Extracts reusable archiveStudy function from archive handlers.
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.
Summary
/studies커맨드 추가: 분기/상태별 스터디 목록 조회 (관리자 전용, ephemeral)/members커맨드 추가: 스터디별 활성 멤버 목록 조회 (전체 멤버 사용 가능, ephemeral + autocomplete)변경 사항
/studies커맨드branch,status옵션으로 필터링 (기본값:status=active)FindByFiltersDB 메서드 추가POSTGRES_*→ 컨테이너 내부 설정 일치)/members커맨드channelautocomplete로 active 스터디 선택FindActiveByStudyIDDB 메서드 추가 (left_at IS NULL필터)📚 **studyName** members (N)+<@userID> (joined: YYYY-MM-DD)DefaultMemberPermissions없음 → 모든 멤버 사용 가능코드 품질 수정
archive_category.gooff-by-one 오류 수정 (50채널 제한 계산)respondArchiveAutocomplete→respondAutocomplete로 통합 (helpers.go)수정 파일 (20개)
bot/commands.go/studies,/members정의 추가bot/handler_studies.gobot/handler_studies_test.gobot/handler_members.gobot/handler_members_test.gobot/bot.gobot/helpers.gorespondAutocomplete통합,isValidBranch추가bot/handler_archive.godb/study_repository.goFindByFilters,FindDistinctActiveBranches추가db/member_repository.goFindActiveByStudyID추가docker-compose.ymlTest plan
go build ./...성공go test ./...전체 통과/studies→ 필터링 조회 확인/studies status:archived→ 아카이브 스터디 조회 확인/membersautocomplete → active 스터디 목록 표시 확인/members선택 → 멤버 목록 + 가입일 표시 확인 (ephemeral)