DisCatSharp Analyzer Rule DCS1102
This rule identifies calls to BanAsync or BanMemberAsync that pass the deleteMessageDays named argument,
which no longer exists — the parameter was renamed to deleteMessageSeconds and now expects a value in seconds.
What the code fix handles
When a named argument deleteMessageDays: is detected, the fixer:
- Renames the argument label from
deleteMessageDays:todeleteMessageSeconds: - If the argument expression is a numeric literal (e.g.
7), multiplies it by86400so the intent is preserved (7→604800) - If the argument expression is not a literal (e.g. a variable or expression), renames the label only and prepends a
/* TODO: was days, now seconds - multiply by 86400 if needed */comment so callers know to review the value manually
Positional callers that relied on the old days-to-seconds conversion shim must be reviewed and updated manually — they are out of scope for this auto-fix.
Why this rule exists
Discord's ban API has always accepted seconds, not days.
A temporary compatibility shim in DisCatSharp converted small integer values (1–7) from days to seconds automatically,
but that shim has now been removed along with the deleteMessageDays parameter name.
Callers using the named argument deleteMessageDays: will get a compile error after the upgrade;
this diagnostic surfaces the issue early with a one-click fix.
The maximum accepted value is 604800 seconds (7 days). Values outside 0–604800 are rejected by the API.