synapse/mass_event_remove.sh
changeset 12 3336c2c14bae
equal deleted inserted replaced
11:3d9a0d238469 12:3336c2c14bae
       
     1 #!/bin/bash
       
     2 # 
       
     3 # remove a list of events from a specific room
       
     4 #
       
     5 # create event list like:
       
     6 #  sudo -u postgres psql synapse -Atc \
       
     7 #   "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
       
     8 #
       
     9 #
       
    10 . ./_config.sh
       
    11 
       
    12 room_id="!NrRVEWbxnLuHdvlPhM:grin.hu"
       
    13 reason="spamming"
       
    14 
       
    15 f_event="events.data"
       
    16 
       
    17 cat $f_event | while read evt; do
       
    18 	#echo "== event: $evt =="
       
    19 	method='PUT'
       
    20 	data="{\"reason\":\"${reason}\"}"
       
    21 	cmd="/_matrix/client/v3/rooms/${room_id}/redact/${evt}/"`uuid`
       
    22 	#echo "${method} $cmd $data"
       
    23 	curl -d "${data}" -X "${method}" -H "Authorization: Bearer ${T}" "${SRV}${cmd}"
       
    24 done
       
    25