Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

  • Understand the current bungo-quiz implementation
  • Review patterns from anime, character-quiz, and achievement-quiz PRs
  • Create BungoQuizBot class extending ChannelLimitedBot
  • Import ChannelLimitedBot and necessary utilities
  • Set wakeWordRegex, username, and iconEmoji properties
  • Move quiz logic from message handler to onWakeWord method
  • Update channel references to use dynamic channel parameter
  • Implement Deferred pattern for quiz start tracking
  • Add deleteProgressMessage call when quiz ends
  • Replace direct slack calls with postMessage method
  • Export BungoQuizBot instance as default
  • Test the changes
  • Address code review feedback (add missing semicolons)
  • Run security checks
  • Remove unnecessary constructor
  • Add isResolved check before resolving deferred in error handler
Original prompt

This section details on the original issue you should resolve

<issue_title>[bungo-quiz] #tsgbot-games 対応 & ChannelLimitedBotクラスを導入</issue_title>
<issue_description>Issue #1099 の対応の一環として、 bungo-quiz BOTの改修を行う。

Slackの #tsgbot-games チャンネルからの起動に対応できるようにする。また、 lib/channelLimitedBot.ts で定義されたChannelLimitedBotクラスを利用し、起動チャンネルの指定と進行中のゲームの通知を導入する。

改修にあたっては、すでに行われた以下の3つのBOTの同様の修正の修正内容を必ず参照し、これらのスタイルを可能な限り踏襲する。

なお、対象のBOTがJavaScriptで書かれている場合は、今回の改修でTypeScriptに書き換える必要はない。このプロジェクトではJavaScriptとTypeScriptを混在させることができる。また、そのほか改修に関係ない改良を加える必要はない。

anime bot

character-quiz bot

achievement-quiz bot

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 21, 2026 03:50
Co-authored-by: hakatashi <3126484+hakatashi@users.noreply.github.com>
Co-authored-by: hakatashi <3126484+hakatashi@users.noreply.github.com>
Copilot AI changed the title [WIP] Update bungo-quiz bot for channel interaction Add ChannelLimitedBot support to bungo-quiz Jan 21, 2026
Copilot AI requested a review from hakatashi January 21, 2026 03:56
return quizMessageDeferred.promise;
}

constructor(
Copy link
Member

Choose a reason for hiding this comment

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

@copilot このconstructorは親クラスのconstructorと同一で、不要です

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the unnecessary constructor in 73b59f6.

channel,
text: `エラー😢\n\`${errorText}\`\n--debugInfo--\n${debugInfo.join('\n')}`,
});
quizMessageDeferred.resolve(null);
Copy link
Member

Choose a reason for hiding this comment

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

@copilot この処理はquizMessageDeferredがすでに解決していない場合のみ実行してください

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added isResolved check before calling resolve(null) in 73b59f6.

Co-authored-by: hakatashi <3126484+hakatashi@users.noreply.github.com>
@sonarqubecloud
Copy link

Copy link
Member

@hakatashi hakatashi left a comment

Choose a reason for hiding this comment

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

LGTM👍️

image

@hakatashi hakatashi marked this pull request as ready for review January 21, 2026 05:09
@hakatashi hakatashi requested a review from Yosshi999 as a code owner January 21, 2026 05:09
Copilot AI review requested due to automatic review settings January 21, 2026 05:09
@tsg-ut-gemini-assistant
Copy link

えへ~

ありがとう!

レビューさせてもらうにゃ!

🔍️🔍️🔍️️

Copy link

@tsg-ut-gemini-assistant tsg-ut-gemini-assistant bot left a comment

Choose a reason for hiding this comment

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

📋 Review Summary

にゃしし!ChannelLimitedBot を使ってお引越しするコードだにゃ!前のコードよりすっきりしていて、とってもいい感じだと思うにゃ!うな、こういうの好きだにゃ!

🔍 General Feedback

  • ChannelLimitedBot の使い方、他のボットとおんなじ感じで書けててえらいにゃ!
  • エラーが起きてもちゃんと考えられるようになってて、前より安心だにゃ!
  • Deferred を使って、クイズが始まったらメッセージを消すのも、賢いやりかただにゃ!

Comment on lines 155 to +157
hintMessages: [
...hints.slice(1, -1).map((text, index, arr) => {
return { channel, text: `次のヒントです!\n> ${text}` }
...hints.slice(1, -1).map((text) => {
return { channel, text: `次のヒントです!\n> ${text}` };

Choose a reason for hiding this comment

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

🟢 にゃしし!ここの {}return は、なくても動くみたいだにゃ!こうすると、もっとスッキリすると思うにゃ!

Suggested change
hintMessages: [
...hints.slice(1, -1).map((text, index, arr) => {
return { channel, text: `次のヒントです!\n> ${text}` }
...hints.slice(1, -1).map((text) => {
return { channel, text: `次のヒントです!\n> ${text}` };
...hints.slice(1, -1).map((text) => ({
channel, text: `次のヒントです!\n> ${text}`,
})),

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the bungo-quiz bot to use the ChannelLimitedBot framework, enabling it to work with the #tsgbot-games channel while following the same architectural pattern established in anime, character-quiz, and achievement-quiz bots.

Changes:

  • Converted bungo-quiz from event-based message handling to class-based ChannelLimitedBot architecture
  • Implemented Deferred pattern for tracking quiz start messages and managing progress message lifecycle
  • Added proper error handling with isResolved check to prevent double-resolution of promises

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.

[bungo-quiz] #tsgbot-games 対応 & ChannelLimitedBotクラスを導入

2 participants