Draupnir Demo Script

This is a demo (as in a stage script) that I performed to introduce Draupnir and its capabilities to some of the PubHubs team.

See also the accompanying Draupnir Demo Notes.

Some preparation for the demonstrator (or "notes to self"):

cd ~/src/PubHubs/pubhubs-ansible
~/tmp/element/launch.sh  # Two Elements: bot.draupnir, self
# Hydrogen (2 tabs). Ctrl-Shift-I for dev-tools.
# - dev-tools: console: document.title="Bad Apple3 (user)"
# - dev-tools: console: document.title="Bad Banana3 (user)"
# Synapse-Admin (2 tabs)
# - Users: search "ad"   # shows 'bad-*' and self 'admin' and Draupnir 'admin'
# - Rooms: seach "The "  # shows the demo rooms

Draupnir Demo

The idea here is to show a few things Draupnir can do.

Draupnir watches our server, or hub, mainly for two kinds of unwanted behaviour:

  • it can watch for bad actors – that is, user accounts listed in a "deny list" or "ban list";
  • it can watch for bad messages – such as any message that contains a word in a list of unwanted keywords, or in other ways such as if a user joins a room and then immediately sends an image, this can be defined as an unwanted behaviour.

If we are a moderator, Draupnir can act on our behalf, performing some action in all our rooms at the same time. For example, it can kick or ban a user, or delete inappropriate messages.

In this demo I am going to show 3 things Draupnir can do:

  • it can kick out a user (temporarily) or ban a user (permanently).
  • it can redact messages (that means delete messages from view) that a user has sent. For example, if we get a report of spamming, we can tell Draupnir to delete all the messages that a spammer has sent.
  • it can add the banned user accounts to a list, a "deny list", and it can watch more than one of these deny lists, and it can share these lists with other hubs (other matrix servers).

Draupnir operates as a "bot", mostly. That means it has its own user account, named something like "moderation bot".

  • Let's see it in Element. Here we are logged in as Draupnir's own user account. I've called this account, "Moderation bot". This is what the Draupnir bot sees in matrix.

  • First, draupnir sees our discussion rooms: the 'arts-room' and the 'busy-room'. The Draupnir bot must be invited into each room that we want it to protect. Probably all of our discussion rooms. We need it to be in those rooms so it can receive and watch the messages.

  • In our discussion rooms, we see the bot has power level 100, meaning admin level. The bot needs a higher power level than regular users, in order to be able to kick and ban users.
  • Also, Draupnir is in a Draupnir management room and a "Code-of-Conduct ban list" room.

But we don't usually log in as that bot account: only the bot does. Let's leave that window in the background.

As a moderator, we log in as our own user account. Here, we see a slightly different view.

  • Here I am logged in using my "Julian (hub moderator)" account.
  • To operate Draupnir, I need to be in the Draupnir bot management room. Here it is. Here is where I issue commands to control the bot, and see its status.
  • If I send the '!draupnir status' command, the bot replies with some status information. Or we can type just '!status' without the bot name, if we configured it that way. With the '!rooms' command we can see which rooms Draupnir is protecting. Here they are. The "arts-room" and the "busy-room" and two others.
  • (Notice: I am not necessarily a member of all the rooms that the bot is monitoring… In this case I am a member of some of them.)


Let's try one of the simplest actions, removing (or "kicking out") a user who misbehaves.

  • Let's look at the user account "bad-apple3". They are a member in 2 rooms.
  • The user @bad-apple is writing nasty comments in the "arts-room"…
  • even after @bad-banana asked them to stop: @bad-apple3: please stop!.
  • The moderator kicks them out the room, like this:
  • !kick @bad-apple3:angler.foad.me.uk #arts-room:angler.foad.me.uk (for badness)
  • See in Bad-Apple3's view, they were kicked from the room.

Kicking out is temporary. The user can re-join, following the usual rules for joining a room.

  • From another room, bad-apple re-joins the arts room: /join #arts-room:angler.foad.me.uk

But that's not very clever. A moderator in the room could have done that.


Draupnir can be more helpful with banning users. Banning is more permanent.

With Draupnir, we need a list to track the banned users.

  • We created a list called "Code of Conduct ban list": we can see it here in Draupnir's account. That's going to be for users who don't respect our hub's Code of Conduct. The list is implemented using a Matrix room, but it's not a room for sending messages, it's used as a database for storing the list of bans. The !status command* shows this list under the heading "Subscribed and protected policy lists", with its short-code (or nickname), "coc" in this case.
  • Now, as a moderator, let's go to our control room and ban a user:
  • !ban @bad-apple3:angler.foad.me.uk coc (bad behaviour)
  • See Draupnir is banning the user in each room. See in Bad Apple's account, it's no longer in the rooms.
  • We see Draupnir adds the user to the ban-list In the management room, we see, "the room id (shortcode: coc) is updated with 1 change: Moderation-Bot ADDED user..." and so on.

Now we have a ban list, and Draupnir is watching this list.

  • !draupnir status shows it's "subscribed and protected" this policy list
  • If we look into the #code-of-conduct deny-list room itself, we see the update there too:
  • Moderation-Bot created a rule banning users matching @bad-apple ...

Draupnir will prevent that user from joining any of our protected rooms.

Let's watch them try to join another room…

  • @bad-apple joins the #deep-room
  • Draupnir bans... and
  • ... we, the moderators, see...

We created this Code of Conduct within the hub. It applies to all rooms in this hub. In a public library, for example, somebody who repeatedly violates the code of conduct might be banned from all the library's rooms.

In that example, so far, we were using one list. We can use different lists for different purposes. Let's create a list of spammers.


Draupnir can watch lists that are created by others, and we can publish our own lists so other hubs can use them. This time, we will publish our "spammers" list. All the hubs can subscribe to it and use it.

  • admin creates a new list…
    • !draupnir list create spam spam-ban-list

Now when we (the moderators) ban someone, we can add their user name to whichever list is appropriate.


  • Other moderators can be in the management room. We can work as a group. And this management room is private, just for the moderators, so we can use our real names and personal accounts here.