[map-guessr] Support #tsgbot-games channel via ChannelLimitedBot#1165
[map-guessr] Support #tsgbot-games channel via ChannelLimitedBot#1165
Conversation
…support Co-authored-by: hakatashi <[email protected]>
| const problem: CoordAteQuizProblem = { | ||
| problemMessage: { | ||
| channel: CHANNEL, | ||
| channel: channel, |
There was a problem hiding this comment.
@copilot 省略記法を使用してください。他の部分も同様です
| channel: channel, | |
| channel, |
There was a problem hiding this comment.
Fixed in 59035a6 — replaced all channel: channel, zoom: zoom, and size: size with their shorthand equivalents throughout the file.
| await slack.chat.postMessage({ | ||
| private readonly aliases: Record<string, string[]>; | ||
|
|
||
| private readonly world: any; |
There was a problem hiding this comment.
@copilot 他の部分から推測して world 変数も型付けしてください
There was a problem hiding this comment.
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.
|
えへ~ ありがとう! レビューさせてもらうにゃ! |
|
There was a problem hiding this comment.
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.tsfrom manualeventClient.on("message")handling to aChannelLimitedBotsubclass withonWakeWord. - Threads
channelthrough quiz message construction (problemFormat/prepareProblem) and applies shorthand property notation. - Tightens typing of
worldasTurf.FeatureCollection<Turf.MultiPolygon>.
| if (message.text.includes('help')) { | ||
| this.postMessage({ | ||
| ...mesHelp, | ||
| ...postOptions, | ||
| ...messageTs, | ||
| channel, | ||
| thread_ts: message.ts, | ||
| }); |
There was a problem hiding this comment.
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.
| message, | ||
| this.aliases, | ||
| this.world, | ||
| message.ts, |
There was a problem hiding this comment.
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.
| message.ts, | |
| channel === message.channel ? message.ts : undefined, |
| text: "`座標当て countries`あるいは `座標あて countries`と入力すると、対応している国・地域の一覧が見られます。", | ||
| }, | ||
| }, | ||
| ], | ||
| channel: CHANNEL, | ||
| }; |
There was a problem hiding this comment.
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.
| @@ -5,16 +5,18 @@ | |||
| import { AteQuizProblem, AteQuizResult } from "../atequiz"; | |||
There was a problem hiding this comment.
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.
| import { AteQuizProblem, AteQuizResult } from "../atequiz"; | |
| import { AteQuizProblem } from "../atequiz"; |





map-guessr/index.tsto useChannelLimitedBotfromlib/channelLimitedBot.tschannel,zoom,sizeinstead ofchannel: channel, etc.)worldasTurf.FeatureCollection<Turf.MultiPolygon>in class property, constructor, andprepareProblemparameterOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.