Pushed the scripts :D
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# This script deletes a given room
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <room_id>"
|
||||
echo "Environment variables MATRIX_BASE_URL and MATRIX_TOKEN must be set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$MATRIX_BASE_URL" ] || [ -z "$MATRIX_TOKEN" ]; then
|
||||
echo "Error: MATRIX_BASE_URL and MATRIX_TOKEN environment variables must be set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ROOM_ID="$1"
|
||||
|
||||
# Config
|
||||
export BASE_URL="${MATRIX_BASE_URL}"
|
||||
export TOKEN="${MATRIX_TOKEN}"
|
||||
|
||||
echo "Deleting room $ROOM_ID from server entirely..."
|
||||
|
||||
# Delete the room :D
|
||||
curl -X DELETE "${BASE_URL}/_synapse/admin/v2/rooms/${ROOM_ID}" \
|
||||
-H "Authorization: Bearer ${TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"purge": true,
|
||||
"force_purge": true,
|
||||
"block": true
|
||||
}'
|
||||
|
||||
echo -e "\nDone."
|
||||
Reference in New Issue
Block a user