Skip to main content
The reports CLI provides tools for managing user-submitted reports through Click-based commands. This CLI runs separately from the main ayaseq command.

Usage

python -m ayase_quart.cli.reports COMMAND [OPTIONS]

Available commands

  • cli-get-reports - List reports with optional filters
  • cli-get-report-count - Count reports matching filters
  • cli-edit-report - Edit report metadata
  • cli-delete-report - Delete a report
  • cli-reports-action - Take moderation action on a report
No authentication is required for CLI commands since access to the server is required to run them.

cli-get-reports

Display reports with optional filters. Results are shown in a formatted table.
python -m ayase_quart.cli.reports cli-get-reports [OPTIONS]

Filter options

--report_parent_id, -id
integer
Filter by specific report ID
--board_shortnames, -boards
choice[]
Filter by board shortnames (can specify multiple)
--is_op, -op
boolean
Filter for reports on opening posts only
--thread_num, -tno
integer
Filter by thread number
--num, -pno
integer
Filter by post number
--submitter_category, -cat
choice
Filter by report category:
  • illegal_content
  • dcma
  • underage
  • embedded_data
  • doxxing
  • work_safe
  • spamming
  • advertising
  • impersonation
  • bots
  • other
--public_access, -access
choice
Filter by visibility:
  • v - visible
  • h - hidden
--mod_status, -status
choice
Filter by moderation status:
  • o - open
  • c - closed
--created_at_gte, -cgte
date
Created at or after this date (YYYY-MM-DD format)
--created_at_lte, -clte
date
Created at or before this date (YYYY-MM-DD format)
--page_num, -pgno
integer
Page number for pagination
--per_page, -pgsize
integer
Number of results per page

Examples

List all open reports:
python -m ayase_quart.cli.reports cli-get-reports --status o
List reports with specific filters from README:
python -m ayase_quart.cli.reports cli-get-reports --public_access v --created_at_gte "2024-01-01"

Output

|   report_parent_id | board_shortname   |      num |   thread_num | public_access   | mod_status   | mod_notes   |   ip_count | submitter_category          | submitter_notes   | link                                                |
|--------------------+-------------------+----------+--------------+-----------------+--------------+-------------+------------+-----------------------------+-------------------+-----------------------------------------------------|
|                  2 | r9k               | 80365251 |     80365251 | v               | c            | wwww!       |          1 | NSFW content on a SFW board | aa                | http://127.0.0.1:9001/r9k/thread/80365251#p80365251 |
|                  3 | r9k               | 80365280 |     80365251 | v               | o            |             |          1 | DCMA                        | aaaaaa            | http://127.0.0.1:9001/r9k/thread/80365251#p80365280 |

cli-get-report-count

Show the total number of reports matching given filters.
python -m ayase_quart.cli.reports cli-get-report-count [OPTIONS]
Accepts the same filter options as cli-get-reports.

Example

python -m ayase_quart.cli.reports cli-get-report-count

Output

Report count: 4

cli-edit-report

Update report metadata fields.
python -m ayase_quart.cli.reports cli-edit-report [OPTIONS]

Options

--report_parent_id, -id
integer
required
Report ID to edit
--public_access, -access
choice
Set visibility: v (visible) or h (hidden)
--mod_status, -status
choice
Set status: o (open) or c (closed)
--mod_notes, -notes
string
Set or update moderation notes

Example

python -m ayase_quart.cli.reports cli-edit-report -id 2 -status c -notes "Resolved"

Output

Updated
Or if report doesn’t exist:
Report not found

cli-delete-report

Permanently delete a report from the database.
python -m ayase_quart.cli.reports cli-delete-report --report_parent_id ID
--report_parent_id, -id
integer
required
Report ID to delete
This permanently deletes the report record. The reported post/media is not affected.

Example

python -m ayase_quart.cli.reports cli-delete-report -id 5

Output

Deleted

cli-reports-action

Take a moderation action on a specific report.
python -m ayase_quart.cli.reports cli-reports-action [OPTIONS]

Options

--report_parent_id, -id
integer
required
Report ID to act on
--action, -action
choice
required
Action to take:
  • report_delete - Delete the report
  • report_close - Close the report
  • report_open - Reopen the report
  • report_save_notes - Save moderation notes
  • post_delete - Delete the reported post
  • post_hide - Hide the reported post
  • post_show - Show the reported post
  • media_delete - Delete the media
  • media_hide - Hide the media
  • media_show - Show the media
--mod_notes, -notes
string
Moderation notes (optional, used with report_save_notes)

Examples

Delete a reported post:
python -m ayase_quart.cli.reports cli-reports-action -id 3 -action post_delete
Hide media from a report:
python -m ayase_quart.cli.reports cli-reports-action -id 4 -action media_hide
Close a report with notes:
python -m ayase_quart.cli.reports cli-reports-action -id 2 -action report_save_notes -notes "Reviewed and approved"

Output

Success (200): Post deleted

Report categories

Available report categories (from src/ayase_quart/enums.py):
ValueDescription
illegal_contentIllegal content
dcmaDMCA copyright violation
underageUnderage content
embedded_dataMedia with hidden embedded data
doxxingPersonal information disclosure
work_safeNSFW on SFW board
spammingSpam or flooding
advertisingCommercial advertising
impersonationImpersonating another user
botsBot or scraper activity
otherOther issues

Moderation actions

Available actions for cli-reports-action:
ActionEffect
report_deletePermanently delete the report
report_closeMark report as closed/resolved
report_openMark report as open
report_save_notesSave moderation notes
post_deletePermanently delete the post
post_hideHide post from public view
post_showMake post visible again
media_deletePermanently delete media files
media_hideHide media from public view
media_showMake media visible again
These actions are defined in src/ayase_quart/enums.py:25-36 as the ReportAction enum.

Implementation details

The reports CLI is implemented using Click (unlike ayaseq which uses argparse):
  • Defined in src/ayase_quart/cli/reports.py
  • Uses @click.group() and @click.command() decorators
  • Includes @report_filters decorator for applying common filter options
  • Uses asyncio.run() to execute async database operations
  • Automatically closes database connections after each command

Running as cron jobs

For automated moderation monitoring:
# Log report counts every hour
0 * * * * cd /path/to/ayase && source venv/bin/activate && python -m ayase_quart.cli.reports cli-get-report-count >> /var/log/ayase/reports.log

# List open reports daily
0 9 * * * cd /path/to/ayase && source venv/bin/activate && python -m ayase_quart.cli.reports cli-get-reports -status o | mail -s "Open Reports" [email protected]

Build docs developers (and LLMs) love