feat: add configurable discord message_limit with code-fence-preserving chunks#140
Open
the3mi wants to merge 1 commit intoopenabdev:mainfrom
Open
feat: add configurable discord message_limit with code-fence-preserving chunks#140the3mi wants to merge 1 commit intoopenabdev:mainfrom
the3mi wants to merge 1 commit intoopenabdev:mainfrom
Conversation
eff3f0d to
8da5032
Compare
- New [platforms] config section; each platform has its own message_limit Reference limits: Discord=2000, Telegram=4096, Slack=39000, Signal=8000 - Discord streaming uses limit-100 buffer; final chunking uses full limit - split_message(text, limit, add_indicator): third param controls (N/N) indicators - split_message_for_streaming(): calls split_message(..., false) — no indicators - test_very_long_line: uses dynamic indicator_len instead of hardcoded +20 - PlatformSettings: default_message_limit() consistent with PlatformsConfig defaults - Discord and Telegram both use their platform-specific defaults (2000 / 4096) - Fix clippy: remove unnecessary trim() before split_whitespace() - All 6 tests pass, clippy clean
8da5032 to
83d2a11
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements configurable
message_limitper platform, with an extensible config structure. Currently only Discord is wired up. Telegram placeholder is present but not yet implemented.Config
Reference limits for future platforms:
Behavior
message_limit - 100buffer (Discord edit overhead)message_limitsplit_message(..., false)— no(1/N)indicators to avoid live-edit noisesplit_message(..., true)— includes(1/N)indicatorsCode changes
config.rs:PlatformSettings+PlatformsConfigreplaces the old flatdiscord.message_limitfield.default_limit_for_platform()centralizes per-platform defaults soPlatformSettings::default()andPlatformsConfig::default()stay consistent.format.rs:split_message(text, limit, add_indicator)— third arg controls indicator injection.split_message_for_streaming()wraps it withadd_indicator=false.discord.rs: Both call sites updated to pass the third arg.Bug fixes in this PR
split_message_for_streaming()was callingsplit_message()directly with no indicator flag, so it still added(1/N)markers despite the name implying otherwise. Fixed by making the indicator behavior explicit.test_very_long_lineused2000 + 20instead oflimit + indicator_len. Now uses dynamic values.PlatformSettings::default()returned 2000, butPlatformsConfig::default()hardcoded telegram at 4096. Now both usedefault_limit_for_platform().Quality checks
cargo test: 6/6 passingcargo clippy: warnings only (no errors)