Skip to content

feat: suggest EMA tournaments in /create_channel - #339

Merged
m4tx merged 4 commits into
masterfrom
feat/create-channel-suggestions
Nov 9, 2026
Merged

m4tx merged 4 commits into
masterfrom
feat/create-channel-suggestions

Conversation

@5zlotych

@5zlotych 5zlotych commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Stacked on feat/create-channel.

/create_channel suggests tournaments from the EMA calendar (cached for 10 minutes); picking one names the channel like 🏆2026-02-kraków-hatsumi-taikai-2026 and sets the topic to Kraków :: 14-15 lutego 2026 :: <link>. Cities and dates are in Polish, and tournaments sharing a name (e.g. Pumpkin Tiles 2026 in Tbilisi and Yerevan) are listed separately.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.58410% with 106 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.81%. Comparing base (e6698a4) to head (03d1827).

Files with missing lines Patch % Lines
chombot-common/src/tournaments_watcher/cache.rs 0.00% 46 Missing ⚠️
...hombot-common/src/slash_commands/create_channel.rs 73.38% 37 Missing ⚠️
chombot-common/src/lib.rs 0.00% 9 Missing ⚠️
chombot-common/src/chombot.rs 0.00% 5 Missing ⚠️
chombot-kcc/src/main.rs 0.00% 5 Missing ⚠️
chombot/src/main.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #339      +/-   ##
==========================================
+ Coverage   50.42%   53.81%   +3.39%     
==========================================
  Files          22       24       +2     
  Lines        1664     1968     +304     
==========================================
+ Hits          839     1059     +220     
- Misses        825      909      +84     
Flag Coverage Δ
rust 53.81% <67.58%> (+3.39%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@5zlotych
5zlotych force-pushed the feat/create-channel-suggestions branch from d1bf56e to 35bb84d Compare November 1, 2026 22:34
@m4tx
m4tx added this pull request to stack #342 November 7, 2026 13:01
@5zlotych
5zlotych force-pushed the feat/create-channel-suggestions branch from 35bb84d to 3c1faf8 Compare November 7, 2026 14:29
@5zlotych
5zlotych force-pushed the feat/create-channel-suggestions branch from 3c1faf8 to 3f6a3a4 Compare November 7, 2026 14:30
@5zlotych
5zlotych force-pushed the feat/create-channel-suggestions branch 2 times, most recently from 6e8072f to 8cf55cd Compare November 7, 2026 20:29
Base automatically changed from feat/create-channel to master November 8, 2026 14:41
Suggests tournaments from the EMA calendar and names their channels like
🏆2026-02-kraków-hatsumi-taikai-2026, with the city, Polish date and
website as the topic.
@m4tx
m4tx force-pushed the feat/create-channel-suggestions branch from 8cf55cd to ebc3ac2 Compare November 8, 2026 14:41
use crate::tournaments_watcher::ema::TournamentEntry;

/// English month names and their Polish genitive forms ("14 lutego").
const MONTHS: [(&str, &str); 12] = [

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.

nit: can we separate logic from data and move the MONTHS and POLISH_CITY_NAMES constants into a separate submodule?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done, moved them to tournament_channel/polish_names.rs

return Ok(tournaments.clone());
}

match get_tournaments().await {

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.

We already retrieve the tournament list in the tournament_watcher module and we really should avoid duplicating this. Right now, the list is updated every 10 minutes for the tournament updates, and then it might be updated here every 10 minutes just to generate the autocomplete suggestions for the slash command.

I really want to avoid making excessive requests to the EMA servers so that they won't block us, and therefore we should unify how tournaments watcher and command autocomplete stores the tournament list cache. One way to do that would be to modify start_tournaments_watcher to get the list using TournamentsCache instead of using get_rcr_tournaments directly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done, the watcher now fetches through the shared TournamentsCache

}
}

/// Like [`Self::get`], but gives up (logging why) after `limit`.

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.

This will return stale data in case a request fails before limit is reached, but not in case the timeout just takes up too much time. Is this intentional? Shouldn't we just return stale data whenever possible in this function?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not intentional, fixed: it returns the stale list on timeout too

@m4tx m4tx left a comment

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.

LGTM

@m4tx
m4tx merged commit bfb51e8 into master Nov 9, 2026
12 checks passed
@m4tx
m4tx deleted the feat/create-channel-suggestions branch November 9, 2026 15:26
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.

2 participants