79 lines
2.4 KiB
Markdown
79 lines
2.4 KiB
Markdown
# Redact Matrix
|
||
|
||
Small script that redacts (deletes) every message written by the user in a given Matrix room.
|
||
|
||
---
|
||
|
||
### 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 Element it is found at: ⚙️ *Quick settings > All Settings > Help & About > Advanced > Access Token*
|
||
|
||

|
||
|
||
On [Cinny](https://app.cinny.in), for example, go to Firefox's Inspect tool, then to the Storage tab, and copy your `cinny_access_token`.
|
||
|
||

|
||
|
||
Other clients may have a similar key with this value.
|
||
|
||
The token is different for each session and remains valid as long as you don't log out.
|
||
|
||
|
||
#### Getting room ID's
|
||
|
||
Room ID's look like this:
|
||
`!cdPNSVToruMtXqGznY:domain.tld`
|
||
|
||
On Element the room ID of any room can be found at ℹ️ *Room info > Settings > Advanced > Internal room ID*
|
||
|
||

|
||
|
||
On Cinny we can see this value in the source of sent messages.
|
||
|
||
|
||
#### Running the script
|
||
|
||
```
|
||
./redact_matrix.py -s matrix.org -t syt_uaY3lMW_nAyiumHhGDhXJBFLKdoY_3RRBuz '!cdPNSVToruMtXqGznY:domain.tld'
|
||
```
|
||
|
||
It's possible to apply the command to more than one room, just add more room id's to the end of the line, separated by space.
|
||
|
||
Additionally, by adding the `-n` flag after `redact_matrix.py` the Nuke mode is turned on, which means that you will not be deleting just your own messages but those of other users in the room as well, so long as you have the proper 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.
|