Communications management commands

Run commands from backend using the active virtual environment. Always inspect python manage.py <command> --help because several options modify or delete data.

manage_chat_permissions

Lists or changes ChatMembership records:

python manage.py manage_chat_permissions --chat-id 62 --list
python manage.py manage_chat_permissions --chat-id 62 --user-id 10 --role moderator

Supported roles are admin, moderator, member and guest. Optional flags can override add/remove-member and pin-message permissions. Prefer the normal API for product workflows; this command is an administrative repair tool.

check_chats

Read-only diagnostics:

python manage.py check_chats --stats
python manage.py check_chats --check CHAT_ID
python manage.py check_chats --check-visibility USER_ID
python manage.py check_chats --find

Options such as --migrate-memberships, --fix, --change-type, --cleanup and --delete change production data. Take a database backup, run the read-only diagnostics first and review --help before using them. Avoid --no-confirm outside a disposable environment.

Other commands in this directory initialize reaction choices, verify chat migration state, populate image dimensions and update department chat names. Their source and --help output are the current contract.