Skip to content

[map-guessr] Support #tsgbot-games channel via ChannelLimitedBot#1165

Open
Copilot wants to merge 4 commits intomasterfrom
copilot/implement-channel-limited-bot
Open

[map-guessr] Support #tsgbot-games channel via ChannelLimitedBot#1165
Copilot wants to merge 4 commits intomasterfrom
copilot/implement-channel-limited-bot

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 1, 2026

  • Refactor map-guessr/index.ts to use ChannelLimitedBot from lib/channelLimitedBot.ts
  • Use shorthand property notation throughout (channel, zoom, size instead of channel: channel, etc.)
  • Type world as Turf.FeatureCollection<Turf.MultiPolygon> in class property, constructor, and prepareProblem parameter
  • TypeScript compiles without errors
Original prompt

This section details on the original issue you should resolve

<issue_title>[map-guessr] #tsgbot-games 対応 & ChannelLimitedBotクラスを導入</issue_title>
<issue_description>Issue #1099 の対応の一環として、 map-guessr 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 changed the title [WIP] Add support for #tsgbot-games channel in map-guessr bot [map-guessr] Support #tsgbot-games channel via ChannelLimitedBot Mar 1, 2026
Comment thread map-guessr/index.ts Outdated
const problem: CoordAteQuizProblem = {
problemMessage: {
channel: CHANNEL,
channel: channel,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot 省略記法を使用してください。他の部分も同様です

Suggested change
channel: channel,
channel,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 59035a6 — replaced all channel: channel, zoom: zoom, and size: size with their shorthand equivalents throughout the file.

Comment thread map-guessr/index.ts Outdated
await slack.chat.postMessage({
private readonly aliases: Record<string, string[]>;

private readonly world: any;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot 他の部分から推測して world 変数も型付けしてください

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 59035a6 — typed world as Turf.FeatureCollection<Turf.MultiPolygon> (verified via countries.geojson which contains only MultiPolygon features). Updated the class property, constructor parameter, and prepareProblem parameter accordingly.

Copy link
Copy Markdown
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.

Image Image

@hakatashi hakatashi marked this pull request as ready for review March 3, 2026 04:59
Copilot AI review requested due to automatic review settings March 3, 2026 04:59
@tsg-ut-gemini-assistant
Copy link
Copy Markdown
Contributor

えへ~

ありがとう!

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

🔍️🔍️🔍️️

Copy link
Copy Markdown
Contributor

@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

map-guessrChannelLimitedBot を使うようにリファクタリングしてくれてありがとにゃ!全体的にいい感じだと思うにゃ。今後のメンテナンスもしやすくなったんじゃないかにゃ?

🔍 General Feedback

  • 型定義をしっかりやっててえらいにゃ! world の型を any からちゃんと設定してるのは、とっても良いことだにゃ!
  • クラスベースに書き直したことで、コードがすっきりして見やすくなったと思うにゃ。にゃししっ!

Comment thread map-guessr/index.ts
@hakatashi hakatashi requested a review from settyan117 as a code owner March 3, 2026 05:02
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 3, 2026

@hakatashi hakatashi enabled auto-merge March 3, 2026 05:04
Copy link
Copy Markdown
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

Refactors the map-guessr bot to use the shared ChannelLimitedBot infrastructure so it can run in the designated games channel and participate in “ongoing game” progress notifications.

Changes:

  • Migrates map-guessr/index.ts from manual eventClient.on("message") handling to a ChannelLimitedBot subclass with onWakeWord.
  • Threads channel through quiz message construction (problemFormat / prepareProblem) and applies shorthand property notation.
  • Tightens typing of world as Turf.FeatureCollection<Turf.MultiPolygon>.

Comment thread map-guessr/index.ts
Comment on lines +715 to 720
if (message.text.includes('help')) {
this.postMessage({
...mesHelp,
...postOptions,
...messageTs,
channel,
thread_ts: message.ts,
});
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

onWakeWord posts help output as a threaded reply using thread_ts: message.ts. When ChannelLimitedBot redirects execution to another channel, message.ts belongs to the original channel, so posting with that thread_ts will fail (invalid thread in the target channel). Consider posting help as a normal message in channel (no thread_ts), and return that posted message ts so callers from disallowed channels can be redirected to the right place.

Copilot uses AI. Check for mistakes.
Comment thread map-guessr/index.ts
message,
this.aliases,
this.world,
message.ts,
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

Same cross-channel threading issue exists when starting a quiz: prepareProblem is given thread_ts: message.ts, but if the bot is invoked from a non-allowed channel, that ts does not exist in the redirected channel and Slack API calls that rely on it will fail. A more robust pattern is to first post a root message in the target channel (or let AteQuiz post the root without thread_ts) and then use the returned ts as the thread root for the rest of the quiz; return that ts from onWakeWord for ChannelLimitedBot progress-linking.

Suggested change
message.ts,
channel === message.channel ? message.ts : undefined,

Copilot uses AI. Check for mistakes.
Comment thread map-guessr/index.ts
Comment on lines 175 to 179
text: "`座標当て countries`あるいは `座標あて countries`と入力すると、対応している国・地域の一覧が見られます。",
},
},
],
channel: CHANNEL,
};
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

mesHelp content still tells users to run the command in the sandbox channel, but this bot now relies on ChannelLimitedBot (default allowedChannels is CHANNEL_GAMES). Please update the help text to match the actual supported/allowed channel(s) so users aren’t misled.

Copilot uses AI. Check for mistakes.
Comment thread map-guessr/index.ts
@@ -5,16 +5,18 @@
import { AteQuizProblem, AteQuizResult } from "../atequiz";
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

Unused import: AteQuizResult is imported but never referenced in this file. Please remove it to keep imports clean and avoid confusing readers about expected return types.

Suggested change
import { AteQuizProblem, AteQuizResult } from "../atequiz";
import { AteQuizProblem } from "../atequiz";

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

@PolinaBalanyeva PolinaBalanyeva left a comment

Choose a reason for hiding this comment

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

LGTM

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.

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

4 participants