about summary refs log tree commit diff
path: root/README.MD
blob: 49d0531d429e7577ba8a9359b39d0380e11105ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# <img src="https://cgit.rory.gay/matrix/tools/MatrixAntiDmSpam.git/plain/MatrixAntiDmSpam/MatrixAntiDmSpam.png" style="height: 4em;"/> MatrixAntiDmSpam
---

A project to make invite spam more manageable at scale.
[Matrix room](https://matrix.to/#/%23anti-dm-spam%3Arory.gay?via=rory.gay)

## Dependencies

- `dotnet-sdk 9.0.200+`
- A device that is online a lot of the time, can be a server

## Setup

```shell
# Check out the repository + submodules
git clone --recursive https://cgit.rory.gay/matrix/tools/MatrixAntiDmSpam.git

# Build and install
./install.sh

# Install or update services to make sure the bot starts up with your system
./install-user-services.sh
```

<details>
    <summary>Manual setup</summary>

```shell
# Check out the repository + submodules
git clone --recursive https://cgit.rory.gay/matrix/tools/MatrixAntiDmSpam.git

# Enter project directory
cd MatrixAntiDmSpam/MatrixAntiDmSpam

# Build the project
dotnet publish -c Release

# Install binaries
sudo cp bin/Release/net9.0/linux-x64/publish /opt/MatrixAntiDmSpam
```

Next, you want to set up a working directory (`~/.local/share/MatrixAntiDmSpam` works well), and copy your access token into a new file (ie. `nano -L ~/.matrix-access-token`).

Additionally, you want to copy `appsettings.Development.json` into your working directory, edit it to your liking and rename it to `appsettings.json`.

<details>
    <summary>Advanced configuration</summary>

    Additionally: you can use `appsettings.SomethingHere.json` and use `DOTNET_ENVIRONMENT=SomethingHere` if you want to set this up for multiple accounts. `appsettings.json` is always loaded for shared values.

    Alternatively, you can use environment variables like `LibMatrixBot__AccessTokenPath=/path/to/access-token` to override values in the configuration file, using double undercores (`__`) as path separator.

</details>

</details>

Note that `PolicyLists` refers to special rooms known as Policy List rooms, which are commonly used by moderation bots as Mjolnir and Draupnir.
The default value (Community Moderation Effort) is a policy list that is used by a fairly large number of communities, and is a good starting point.
Additionally, Element Web supports these for hiding messages via a labs flag.

Also note that these may break certain clients, such as
FluffyChat ([#814](https://github.com/krille-chan/fluffychat/issues/814), [#858](https://github.com/krille-chan/fluffychat/issues/858), [#905](https://github.com/krille-chan/fluffychat/issues/905)).

## Running

```shell
# Run the bot
cd ~/.local/share/MatrixAntiDmSpam
/opt/MatrixAntiDmSpam/MatrixAntiDmSpam
```