fix(discord): cap lines per message

This commit is contained in:
Peter Steinberger
2026-01-08 04:02:04 +01:00
parent 6e4174b5dc
commit bf2daeb3ae
18 changed files with 373 additions and 32 deletions

View File

@@ -212,7 +212,11 @@ describe("config identity defaults", () => {
routing: {},
whatsapp: { allowFrom: ["+15555550123"], textChunkLimit: 4444 },
telegram: { enabled: true, textChunkLimit: 3333 },
discord: { enabled: true, textChunkLimit: 1999 },
discord: {
enabled: true,
textChunkLimit: 1999,
maxLinesPerMessage: 17,
},
signal: { enabled: true, textChunkLimit: 2222 },
imessage: { enabled: true, textChunkLimit: 1111 },
},
@@ -229,6 +233,7 @@ describe("config identity defaults", () => {
expect(cfg.whatsapp?.textChunkLimit).toBe(4444);
expect(cfg.telegram?.textChunkLimit).toBe(3333);
expect(cfg.discord?.textChunkLimit).toBe(1999);
expect(cfg.discord?.maxLinesPerMessage).toBe(17);
expect(cfg.signal?.textChunkLimit).toBe(2222);
expect(cfg.imessage?.textChunkLimit).toBe(1111);

View File

@@ -121,6 +121,7 @@ const FIELD_LABELS: Record<string, string> = {
"discord.retry.minDelayMs": "Discord Retry Min Delay (ms)",
"discord.retry.maxDelayMs": "Discord Retry Max Delay (ms)",
"discord.retry.jitter": "Discord Retry Jitter",
"discord.maxLinesPerMessage": "Discord Max Lines Per Message",
"slack.dm.policy": "Slack DM Policy",
"discord.token": "Discord Bot Token",
"slack.botToken": "Slack Bot Token",
@@ -193,6 +194,8 @@ const FIELD_HELP: Record<string, string> = {
"Maximum retry delay cap in ms for Discord outbound calls.",
"discord.retry.jitter":
"Jitter factor (0-1) applied to Discord retry delays.",
"discord.maxLinesPerMessage":
"Soft max line count per Discord message (default: 17).",
"slack.dm.policy":
'Direct message access control ("pairing" recommended). "open" requires slack.dm.allowFrom=["*"].',
};

View File

@@ -411,6 +411,12 @@ export type DiscordAccountConfig = {
groupPolicy?: GroupPolicy;
/** Outbound text chunk size (chars). Default: 2000. */
textChunkLimit?: number;
/**
* Soft max line count per Discord message.
* Discord clients can clip/collapse very tall messages; splitting by lines
* keeps replies readable in-channel. Default: 17.
*/
maxLinesPerMessage?: number;
mediaMaxMb?: number;
historyLimit?: number;
/** Retry policy for outbound Discord API calls. */

View File

@@ -254,6 +254,7 @@ const DiscordAccountSchema = z.object({
token: z.string().optional(),
groupPolicy: GroupPolicySchema.optional().default("open"),
textChunkLimit: z.number().int().positive().optional(),
maxLinesPerMessage: z.number().int().positive().optional(),
mediaMaxMb: z.number().positive().optional(),
historyLimit: z.number().int().min(0).optional(),
retry: RetryConfigSchema,