Skip to content

[octas] Migrate to ChannelLimitedBot to support #tsgbot-games#1169

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/add-channel-limited-bot-support
Draft

[octas] Migrate to ChannelLimitedBot to support #tsgbot-games#1169
Copilot wants to merge 2 commits intomasterfrom
copilot/add-channel-limited-bot-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 1, 2026

The octas bot was hardcoded to CHANNEL_SANDBOX. This migrates it to ChannelLimitedBot, enabling activation from #tsgbot-games with progress notifications posted to #sandbox.

octas/index.ts

  • Convert flat function export to OctasBot extends ChannelLimitedBot
  • Set wakeWordRegex = /^octas$/i, username = 'octas', iconEmoji = ':octopus:'
  • Add channel: string | null to State; set on game start, cleared on halt
  • Replace all process.env.CHANNEL_SANDBOX hardcoding with this.state.channel
  • Replace slack.chat.postMessage({..., username, icon_emoji}) with this.postMessage()
  • Override onWakeWord: starts/cancels game, returns thread ts for progress message tracking
  • Override onMessageEvent: calls super (wake word handling), then routes thread replies to waitForPlayers/processHand
  • Call deleteProgressMessage(this.state.thread) on game end
class OctasBot extends ChannelLimitedBot {
    protected override readonly wakeWordRegex = /^octas$/i;
    protected override readonly username = 'octas';
    protected override readonly iconEmoji = ':octopus:';

    protected override async onWakeWord(message: GenericMessageEvent, channel: string): Promise<string | null> {
        if (this.state.isHolding) { /* cancel current game */ }
        if (message.thread_ts) return null;
        return await processQueue.add(() => this.launch(channel)) ?? null;
    }
}

octas/index.test.ts

  • Set process.env.CHANNEL_GAMES = slack.fakeChannel (bot now defaults to CHANNEL_GAMES)
  • Add jest.mock('../lib/slackUtils') (required since ChannelLimitedBot imports from it)
Original prompt

This section details on the original issue you should resolve

<issue_title>[octas] #tsgbot-games 対応 & ChannelLimitedBotクラスを導入</issue_title>
<issue_description>Issue #1099 の対応の一環として、 octas 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] Add ChannelLimitedBot class support for #tsgbot-games [octas] Migrate to ChannelLimitedBot to support #tsgbot-games 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.

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

2 participants