Skip to content

feat: 벌금 납부 확인을 버튼 기반으로 변경#24

Merged
choihooo merged 3 commits intodevfrom
feat/dm-button-payment
Mar 10, 2026
Merged

feat: 벌금 납부 확인을 버튼 기반으로 변경#24
choihooo merged 3 commits intodevfrom
feat/dm-button-payment

Conversation

@choihooo
Copy link
Copy Markdown
Collaborator

🎯 Summary

이 PR의 목적을 한 줄로 요약해주세요

  • MessageContent Intent 없이 동작하도록 벌금 납부 확인을 텍스트 파싱에서 Discord 버튼/인터랙션 방식으로 변경

🔴 AS-IS

기존 상태 또는 문제점

  • MessageContent Intent가 비활성화되어 있어 message.content가 빈 문자열로 반환됨
  • 봇이 100개 미만 서버라 Discord에서 Message Content Intent 활성화 불가
  • 사용자가 DM으로 "납부완료"라고 답장해도 인식하지 못해 벌금 상태가 업데이트되지 않음

🟢 TO-BE

변경 후 상태 또는 개선점

  • 벌금 알림 DM에 "✅ 납부 완료" 버튼 추가
  • 버튼 클릭 시 InteractionCreate 이벤트로 처리하여 MessageContent Intent 불필요
  • 사용자가 버튼 클릭 한 번으로 벌금 상태 PAID로 자동 변경
  • Discord Developer Portal 설정 없이 동작

💬 참고사항

리뷰어가 알아야 할 내용, 논의 포인트, 주의사항 등

  • P0 feat: Supabase Auth + Discord OAuth 인증 전환 #2 문제 해결 (docs/plans/26-03-10-bot-review-findings.md)
  • 테스트 완료: 최호 계정으로 실제 DM 발송 및 버튼 클릭 테스트 성공
  • 레거시 함수 isPaymentConfirmation(), PaymentConfirmationWords@deprecated 마크 (테스트 호환성 유지)
  • 각 벌금마다 별도 버튼 생성으로 여러 벌금이 있어도 개별 납부 가능

MessageContent Intent (100+ 서버 요구사항) 없이 동작하도록
텍스트 파싱 방식에서 Discord 버튼/인터랙션 방식으로 변경

변경 사항:
- dm-handler.ts: MessageCreate → InteractionCreate 이벤트 핸들러 변경
- sendFineNotification/sendFineReminder: "납부 완료" 버튼 추가
- handleButtonInteraction: 버튼 클릭 시 벌금 상태 PAID로 변경
- bot.ts: 주석 업데이트 (Intent 활성화 불가능 명시)
- fine.service.ts: isPaymentConfirmation, PaymentConfirmationWords @deprecated

P0 #2 MessageContent Intent 비활성화 문제 해결:
- 봇이 1개 서버에만 있어 Message Content Intent 활성화 불가
- 버튼/컴포넌트 기반으로 변경하여 Intent 없이 동작

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@choihooo choihooo requested a review from bbbang105 as a code owner March 10, 2026 06:10
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
study-admin-web Ready Ready Preview, Comment Mar 10, 2026 6:34am

@bbbang105 bbbang105 added the 🚀 feat 새로운 기능 추가 / 일부 코드 추가 / 일부 코드 수정 (리팩토링과 구분) / 디자인 요소 수정 label Mar 10, 2026
P0 #9 문제 해결:
- 인메모리 Map → DB pendingConfirmation 컬럼으로 변경
- 봇 재시작 시 대기 중인 확인 내역 소실 문제 해결

변경 사항:
- schema.ts: fines 테이블에 pendingConfirmation 컬럼 추가
- dm-handler.ts: addPendingConfirmation, removePendingConfirmation을 DB로 변경
- isPendingConfirmation: DB 조회로 변경
- 불필요한 Map 관리 함수 제거

DB 마이그레이션:
- ALTER TABLE fines ADD COLUMN pending_confirmation boolean DEFAULT true
- CREATE INDEX idx_fines_pending_confirmation

테스트 완료:
- ✅ DB에 벌금 생성
- ✅ DM 버튼 발송
- ✅ 버튼 클릭 시 DB에서 pending_confirmation false로 변경
- ✅ 벌금 상태 PAID로 업데이트

장점:
- 봇 재시작 후에도 대기 중인 벌금 확인 유지
- DB 조회로 실시간 동시성 문제 해결
- 인메모리 상태 관리 불필요

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bbbang105 bbbang105 added the ✂️ remove 패키지 혹은 폴더, 클래스 삭제 label Mar 10, 2026
@choihooo choihooo merged commit b1d5463 into dev Mar 10, 2026
7 checks passed
@choihooo choihooo deleted the feat/dm-button-payment branch March 10, 2026 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚀 feat 새로운 기능 추가 / 일부 코드 추가 / 일부 코드 수정 (리팩토링과 구분) / 디자인 요소 수정 🔄 refactor 코드 리팩토링 ✂️ remove 패키지 혹은 폴더, 클래스 삭제

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants