synapse/mass_event_remove.sh
changeset 12 3336c2c14bae
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/synapse/mass_event_remove.sh	Wed Mar 08 22:27:54 2023 +0100
@@ -0,0 +1,25 @@
+#!/bin/bash
+# 
+# remove a list of events from a specific room
+#
+# create event list like:
+#  sudo -u postgres psql synapse -Atc \
+#   "SELECT event_id FROM events e LEFT JOIN event_json ej USING(event_id) WHERE e.room_id='"'!'"NrRVEWbxnLuHdvlPhM:grin.hu' AND ej.json ~ 'gorelol.ori-club.xyz'" > events.data
+#
+#
+. ./_config.sh
+
+room_id="!NrRVEWbxnLuHdvlPhM:grin.hu"
+reason="spamming"
+
+f_event="events.data"
+
+cat $f_event | while read evt; do
+	#echo "== event: $evt =="
+	method='PUT'
+	data="{\"reason\":\"${reason}\"}"
+	cmd="/_matrix/client/v3/rooms/${room_id}/redact/${evt}/"`uuid`
+	#echo "${method} $cmd $data"
+	curl -d "${data}" -X "${method}" -H "Authorization: Bearer ${T}" "${SRV}${cmd}"
+done
+