Matrix.org/mjolnir

From Meta, a Wikimedia project coordination wiki

mjolnir is a moderation bot for Matrix.org rooms. We run our own instance: @wiki-mjolnir:matrix.org.

Usage[edit]

You must be invited into the #wikimedia-moderators:matrix.org matrix: control room. Note that anyone who has access to this room effectively has moderator access across all rooms being protected.

To ban a user:

!ban bans user <@user:example.org> <reason>

"bans" is the name of the shared ban list. "user" indicates you're banning a user. Wildcard bans are allowed, but will require extra confirmation.

The "reason" is optional, however if your reason includes the word "spam" in it, the user's messages will also be automatically deleted.

To unban:

!unban bans user <@user:example.org> true

Additional commands can be seen by asking !help. Note that all the documentation will show you prefixing commands with !mjolnir. However, there's no other bot in the moderation room, so that prefix is not required.

There's also documentation for moderators.

Adding a new room[edit]

!rooms add <#foo:matrix.org>

The wiki-mjolnir account should join the room, and in the control room it should complain about its power levels. Adjust the room settings so "Send m.room.server_acl events" can be done by Moderators, and then promote the wiki-mjolnir user to Moderator.

Deployment[edit]

Currently running out of the mjolnir tool on Toolforge. The account credentials (password, email) are located at ~/account.

To upgrade mjolnir to a new release:

tools.mjolnir@tools-sgebastion-11:~$ webservice node16 shell
tools.mjolnir@interactive:~$ cd mjolnir16/
tools.mjolnir@interactive:~/mjolnir16$ git pull
tools.mjolnir@interactive:~/mjolnir16$ git checkout v1.x.x # Whatever the new version is
tools.mjolnir@interactive:~/mjolnir16$ ~/node_modules/.bin/yarn install
tools.mjolnir@interactive:~/mjolnir16$ ~/node_modules/.bin/yarn build
tools.mjolnir@interactive:~/mjolnir16$ exit
# Restart by deleting pod
tools.mjolnir@tools-sgebastion-11:~$ kubectl delete pods $(kubectl get pods | grep mjolnir | awk '{ print $1 }')

Notifications[edit]

This account also runs uatu, a Matrix bot which watches channels and provides notifications for various events, similar to wmopbot.

To upgrade uatu to a new release:

tools.mjolnir@tools-sgebastion-10:~$ ./update-uatu.sh 0.1.7
Downloading v0.1.7
Restarting uatu pod
pod "uatu-7db8d45f95-7ksrl" deleted

External links[edit]