Reddit/moderation
Reddit moderation model for subreddit management.
Reddit moderation API wrapper providing modqueue inspection, user reports, moderator action logs, content listing, and moderation actions (approve, remove, ban, modmail, flair). Designed for automated moderation pipelines. Authentication via Reddit OAuth2 script app flow with credentials stored in swamp vault.
Quick Start
swamp extension pull @webframp/reddit/moderation
swamp model create @webframp/reddit/moderation reddit-mod \
--global-arg subreddit=aoe4 \
--global-arg clientId=vault://reddit/clientId \
--global-arg clientSecret=vault://reddit/clientSecret \
--global-arg username=vault://reddit/username \
--global-arg password=vault://reddit/password \
--global-arg userAgent="swamp:aoe4mod:v1.0 (by /u/yourbot)"
swamp model method run reddit-mod get_modqueue2026.08.21.2
Changed:
- Reddit API errors (auth, GET, POST) now name the request path (and, for the OAuth2 token request, the account username) instead of only the HTTP status code and response body — e.g. "Reddit API GET /r/foo/about/modqueue failed (500): ..." instead of "Reddit API error (500): ...".
- Moderation action failures (
approve,remove,ban_user,send_modmail,flair_post) now include the target item id, username, or subreddit in the thrown error, instead of only the raw Reddit error payload — so a failed action is traceable back to what it was acting on. - A network-level failure (DNS, connection refused, TLS) talking to Reddit now surfaces which request it was attempting instead of a bare, unlabeled fetch exception.
Global Arguments
| Argument | Type | Description |
|---|---|---|
| subreddit | string | Subreddit name (without r/ prefix) |
| clientId | string | Reddit OAuth2 application client ID |
| clientSecret | string | Reddit OAuth2 application client secret |
| username | string | Reddit account username |
| password | string | Reddit account password |
| userAgent | string | User-Agent string for Reddit API requests (e.g. 'swamp:modbot:v1.0 by /u/yourname') |
| Argument | Type | Description |
|---|---|---|
| type | enum | Filter modqueue by item type |
| limit | number | Maximum number of items to return |
| Argument | Type | Description |
|---|---|---|
| limit | number | Maximum number of reported items to return |
| Argument | Type | Description |
|---|---|---|
| action? | string | Filter by action type (e.g. removecomment, approvelink, banuser) |
| mod? | string | Filter by moderator username |
| limit | number | Maximum number of log entries to return |
| Argument | Type | Description |
|---|---|---|
| sort | enum | Sort order for comments |
| limit | number | Maximum number of comments to return |
| Argument | Type | Description |
|---|---|---|
| sort | enum | Sort order for posts |
| limit | number | Maximum number of posts to return |
| Argument | Type | Description |
|---|---|---|
| username | string | Reddit username to look up |
| Argument | Type | Description |
|---|---|---|
| thingId | string | Reddit fullname of the item to approve (e.g. t3_abc123 or t1_xyz789) |
| Argument | Type | Description |
|---|---|---|
| thingId | string | Reddit fullname of the item to remove (e.g. t3_abc123 or t1_xyz789) |
| spam | boolean | Mark as spam (default: false) |
| modNote? | string | Internal mod note (up to 100 chars) |
| Argument | Type | Description |
|---|---|---|
| username | string | Reddit username to ban |
| duration? | number | Ban duration in days (omit for permanent) |
| banReason? | string | Reason shown to the banned user |
| modNote? | string | Internal moderator note |
| Argument | Type | Description |
|---|---|---|
| to | string | Recipient username |
| subject | string | Message subject |
| body | string | Message body (markdown supported) |
| Argument | Type | Description |
|---|---|---|
| thingId | string | Reddit fullname of the post to flair (e.g. t3_abc123) |
| flairTemplateId | string | Flair template ID to apply |
Resources
2026.08.21.1
Changed: Tightened clientId, clientSecret, username, password,
and userAgent on the global-args schema to require non-empty strings. All
five are required OAuth2/account credentials that the Reddit API never
accepts empty — this catches misconfigured vault references or blank
--global-arg values at model-create time instead of a confusing API
failure on first method call.
2026.07.18.1
Added: An upgrades array entry (no-op) to moderation.ts for proper typeVersion tracking on existing instances. No schema or behavior changes.
2026.07.16.1
Changed: Internal-only version bump. PR #183 touched deno.json (added a fmt:check task) and reordered a test-file import, but neither file is part of the published bundle — this release's published content is identical to 2026.06.23.1.
2026.07.18.1
Added: An upgrades array entry (no-op) to moderation.ts for proper typeVersion tracking on existing instances. No schema or behavior changes.
2026.07.16.1
Changed: Internal-only version bump. PR #183 touched deno.json (added a fmt:check task) and reordered a test-file import, but neither file is part of the published bundle — this release's published content is identical to 2026.06.23.1.
2026.07.16.1
Changed: Internal-only version bump. PR #183 touched deno.json (added a fmt:check task) and reordered a test-file import, but neither file is part of the published bundle — this release's published content is identical to 2026.06.23.1.
Modified 1 models
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned