Skip to content

[qrcode-quiz] Add #tsgbot-games support via ChannelLimitedBot#1173

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/update-qrcode-quiz-bot
Draft

[qrcode-quiz] Add #tsgbot-games support via ChannelLimitedBot#1173
Copilot wants to merge 2 commits intomasterfrom
copilot/update-qrcode-quiz-bot

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 1, 2026

qrcode-quiz was hardcoded to CHANNEL_SANDBOX with a plain event listener. This migrates it to ChannelLimitedBot, enabling #tsgbot-games support and in-progress game notifications — consistent with the anime/character-quiz/achievement-quiz migrations.

Key changes

  • New QrcodeQuizBot class extends ChannelLimitedBot with:

    • wakeWordRegex = /^QR当てクイズ/
    • onWakeWord override using mutex.runExclusive + Deferred pattern (matching character-quiz style)
    • Calls deleteProgressMessage on quiz completion
  • QrAteQuiz.start() updated to accept and forward AteQuizStartOption, enabling the onStarted callback needed to capture the quiz message ts for progress tracking

  • Import fix: GenericMessageEvent changed from @slack/bolt@slack/web-api for compatibility with ChannelLimitedBot's method signatures

class QrcodeQuizBot extends ChannelLimitedBot {
    protected override readonly wakeWordRegex = /^QR/;
    protected override readonly username = 'QR当てクイズ';
    protected override readonly iconEmoji = ':qr:';

    protected override onWakeWord(message: GenericMessageEvent, channel: string): Promise<string | null> {
        const quizMessageDeferred = new Deferred<string | null>();
        mutex.runExclusive(async () => {
            // ... quiz logic
            const result = await ateQuiz.start({
                mode: 'normal',
                onStarted(startMessage) {
                    quizMessageDeferred.resolve(startMessage.ts!);
                },
            });
            await this.deleteProgressMessage(await quizMessageDeferred.promise);
        });
        return quizMessageDeferred.promise;
    }
}

export default (slackClients: SlackInterface) => new QrcodeQuizBot(slackClients);
Original prompt

This section details on the original issue you should resolve

<issue_title>[qrcode-quiz] #tsgbot-games 対応 & ChannelLimitedBotクラスを導入</issue_title>
<issue_description>Issue #1099 の対応の一環として、 qrcode-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)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: hakatashi <3126484+hakatashi@users.noreply.github.com>
Copilot AI changed the title [WIP] Update qrcode-quiz bot for #tsgbot-games channel [qrcode-quiz] Add #tsgbot-games support via ChannelLimitedBot Mar 1, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 1, 2026

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.

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

2 participants