.gitignore | ||
element_room_id.png | ||
element.png | ||
image.jpg | ||
LICENSE | ||
README.md | ||
redact_all_messages.py |
Redact Matrix
Small script that redacts (deletes) every message written by the user in specified room(s).
Usage
Installation
Download the script:
git clone https://git.thisisjoes.site/cynic/redact-matrix.git
cd redact-matrix
chmod +x redact_matrix.py # optional
Getting your access token
On Cinny, for example, go to Firefox's Inspect tool, to the Storage tab, and copy your cinny_access_token
.
Other clients may have a similar key with this value.
On Element it is found at: ⚙️ Quick settings > All Settings > Help & About > Advanced > Access Token
The token is different for each session and remains valid as long as you don't log out.
Getting the room id
On Cinny we can see this value in the source of sent messages.
The room id looks like this:
!cdPNSVToruMtXqGznY:domain.tld
On Element it can be found at ℹ️ Room info > Settings > Advanced > Internal room ID
Running the script
python redact_matrix.py -s matrix.thisisjoes.site -t syt_uaY3lMW_nAyiumHhGDhXJBFLKdoY_3RRBuz \!xTDdCBHByVyZtZEmNI:hackliberty.org '!cdPNSVToruMtXqGznY:domain.tld'
As we can see here, it is possible to apply the command to more than one room.
Additionally, by adding the -n
flag after redact_matrix.py
the Nuke mode is turned on, which means that you will not be deleting only your own messages but also those of other users in the room, as long as you have permissions (e.g. admin). In other words, it attempts to nuke the room, so, please, be very careful with this flag.
When in doubt, see the help by passing --help
or -h
:
# python redact_matrix.py --help
usage: redact_matrix.py [-h] [-n] -s HOMESERVER -t ACCESS_TOKEN [room_ids ...]
positional arguments:
room_ids room ID's
options:
-h, --help show this help message and exit
-n, --nuke try and delete all messages in the room, not only mine
required:
-s HOMESERVER, --homeserver HOMESERVER
homeserver's domain name
-t ACCESS_TOKEN, --access-token ACCESS_TOKEN
Matrix access token
Note:
Once it has deleted all of your messages it may remove the room itself, if you had permissions to do so.