Skip to content

feat: add /create_channel command - #338

Merged
m4tx merged 3 commits into
masterfrom
feat/create-channel
Nov 8, 2026
Merged

m4tx merged 3 commits into
masterfrom
feat/create-channel

Conversation

@5zlotych

@5zlotych 5zlotych commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Split out of #336, stacked: this → EMA suggestions → update reactions → #archiwum votes.

/create_channel name [category] [topic] (Manage Channels) creates a text channel in the current channel's category unless another one is picked, and only if both the member and the bot could create it there, so per-category permissions are respected. Names are normalized the way Discord does it, and an existing channel with the same name in that category is linked instead of duplicated.

In chombot-kcc it's behind FEATURE_CREATE_CHANNEL.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.80822% with 94 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.42%. Comparing base (c4b347e) to head (c2446c3).

Files with missing lines Patch % Lines
...hombot-common/src/slash_commands/create_channel.rs 0.00% 66 Missing ⚠️
chombot-common/src/channel_creator.rs 89.18% 24 Missing ⚠️
chombot-kcc/src/main.rs 0.00% 3 Missing ⚠️
chombot/src/main.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #338      +/-   ##
==========================================
+ Coverage   46.68%   50.42%   +3.73%     
==========================================
  Files          20       22       +2     
  Lines        1373     1664     +291     
==========================================
+ Hits          641      839     +198     
- Misses        732      825      +93     
Flag Coverage Δ
rust 50.42% <67.80%> (+3.73%) ⬆️

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 branch from af3f692 to 45ddbcb Compare November 1, 2026 22:34
Creates a text channel in the current (or chosen) category if both the
member and the bot could create it there, and links an existing channel
with the same name instead of duplicating it.
@m4tx
m4tx force-pushed the feat/create-channel branch from 45ddbcb to 5b5c74d Compare November 7, 2026 13:00
@m4tx
m4tx added this pull request to stack #342 November 7, 2026 13:01

const fn is_separator(c: char) -> bool {
c.is_whitespace()
|| matches!(c, '-' | '\u{2013}' | '\u{2014}')

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.

Can you add a comment on what are these unicode characters here?

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, they're en and em dashes turned into -

c.is_control()
|| matches!(
c,
'\'' | '"' | '`' | '\u{2018}' | '\u{2019}' | '\u{201C}' | '\u{201D}'

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.

Same here.

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, they are different types of quotes to be dropped

Comment thread chombot-common/src/channel_creator.rs Outdated

#[derive(Debug, PartialEq, Eq)]
pub enum Placement {
Allowed(Option<ChannelId>),

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 expect this to be Some, as otherwise we return an error anyway (Guild {guild_id} is not cached).

Shouldn't we therefore drop the custom Placement enum and just use a regular Result<ChannelId, String> instead? I don't see much value in this, unless there's any plan to expand this in the future.

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.

None means the channel should be created outside any category

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.

Ah, if that's the case, let's keep the Placement enum but instead of the old version, let's have InCategory(ChannelId) and OutsideAnyCategory (or similar) variants then. None is confusing, especially if it's undocumented.

So decide_placement should return Result<Placement, String> then.

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

@5zlotych
5zlotych force-pushed the feat/create-channel branch from 0d6f5f2 to 88c83fe Compare November 7, 2026 14:30
@5zlotych
5zlotych force-pushed the feat/create-channel branch from 88c83fe to 6d2fcbb Compare November 7, 2026 14:34
@m4tx
m4tx merged commit e6698a4 into master Nov 8, 2026
12 checks passed
@m4tx
m4tx deleted the feat/create-channel branch November 8, 2026 14:41
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