Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 다른 슬래시 커맨드 사용시 호출되지 않도록 수정 #587

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

Sangwook02
Copy link
Member

@Sangwook02 Sangwook02 commented Aug 7, 2024

🌱 관련 이슈

📌 작업 내용 및 특이사항

  • 다른 슬래시 커맨드 사용시 같이 호출되는 문제가 있어서,디스코드 id 배치 명령 리스너에 if 조건 추가했습니다.

📝 참고사항

📚 기타

Summary by CodeRabbit

  • 새로운 기능

    • 특정 명령어에 대한 조건부 체크를 추가하여 Discord 명령 처리 로직을 개선했습니다. 이제 명령어의 이름이 지정된 상수와 일치하는 경우에만 이벤트가 처리됩니다.
  • 버그 수정

    • 의도하지 않은 명령의 호출을 방지하기 위해 명령 처리의 흐름을 수정했습니다.

@Sangwook02 Sangwook02 self-assigned this Aug 7, 2024
@Sangwook02 Sangwook02 requested a review from a team as a code owner August 7, 2024 12:56
Copy link

coderabbitai bot commented Aug 7, 2024

Walkthrough

DiscordIdBatchCommandListener 클래스의 onSlashCommandInteraction 메서드에 조건부 체크를 추가했습니다. 이제 이벤트 이름이 COMMAND_NAME_BATCH_DISCORD_ID와 일치할 때만 delegate 메서드가 호출되어, 불필요한 명령 처리로부터 코드를 보호합니다. 이를 통해 명령 처리 로직을 더욱 세밀하게 개선했습니다.

Changes

파일 변경 요약
src/main/java/com/gdschongik/gdsc/... onSlashCommandInteraction 메서드에 조건부 체크 추가, COMMAND_NAME_BATCH_DISCORD_ID와의 비교를 통해 특정 명령만 처리하도록 수정. 정적 임포트 추가로 가독성 향상.

Assessment against linked issues

Objective Addressed Explanation
디스코드 인증코드 발급 시 존재하지 않는 커뮤니티 멤버 오류 수정 (#586)

Poem

🐰 Rabbit hops with glee,
Code now flows so free!
Commands clear, no more strife,
Improved logic, better life!
In the Discord realm, we thrive! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Aug 7, 2024

Job Summary for Gradle

Check Style and Test to Develop :: build-test
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
gdsc check 8.5 Build Scan published

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8e7c7d9 and 8dbb437.

Files selected for processing (1)
  • src/main/java/com/gdschongik/gdsc/domain/discord/application/listener/DiscordIdBatchCommandListener.java (2 hunks)
Additional comments not posted (1)
src/main/java/com/gdschongik/gdsc/domain/discord/application/listener/DiscordIdBatchCommandListener.java (1)

3-3: 좋은 변경 사항입니다: static import 추가

DiscordConstant의 static import를 추가하여 코드 가독성을 향상시켰습니다.

Comment on lines +20 to +22
if (event.getName().equals(COMMAND_NAME_BATCH_DISCORD_ID)) {
discordIdBatchCommandHandler.delegate(event);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋은 변경 사항입니다: 조건부 체크 추가

onSlashCommandInteraction 메서드에 조건부 체크를 추가하여, 이벤트 이름이 COMMAND_NAME_BATCH_DISCORD_ID와 일치할 때만 delegate 메서드가 호출되도록 했습니다. 이를 통해 불필요한 명령 처리를 방지할 수 있습니다.

제안: 조건부 체크 가독성 개선

조건부 체크의 가독성을 높이기 위해, 조건문을 별도의 메서드로 추출하는 것을 고려해보세요.

public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) {
    if (isBatchDiscordIdCommand(event)) {
        discordIdBatchCommandHandler.delegate(event);
    }
}

private boolean isBatchDiscordIdCommand(SlashCommandInteractionEvent event) {
    return event.getName().equals(COMMAND_NAME_BATCH_DISCORD_ID);
}

Copy link
Member

@uwoobeat uwoobeat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@AlmondBreez3 AlmondBreez3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Sangwook02 Sangwook02 merged commit 388c25b into develop Aug 7, 2024
1 check passed
@Sangwook02 Sangwook02 deleted the fix/586-discord-id-batch-command branch August 7, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 디스코드 인증코드 발급 시 존재하지 않는 커뮤니티 멤버 오류 수정
3 participants