Skip to main content


 
I've been messing around with the Matrix Python SDK. It makes things remarkably easy. 👍

#python #matrix

How do bots work in Matrix? Are they scoped to a particular HomeServer? I don't understand their boundaries in a federated chat world.

I didn't follow any guides, so maybe there's a more clever way to do it, but this one just logs in via a regular account, joins rooms, and listens for events to trigger it. So, yes.

OK, so it's just a proxy for a user, not something that runs alongside a particular homeserver and becomes available to all rooms hosted on that particular server.

Can users bring a bot to a room simply by inviting it?

(And where did you find the documentation? I've been looking around but cannot find it.)

Invites need to be approved interactively. This bot listens for invites and auto-accepts them. You can invite @chestbridge:matrix.gibberfish.org to try it.

I used the python SDK docs and just kind of figured it out for myself.

The bot's running in a container on a box in my basement :)

Bots are just "normal" users. Matrix doesn't have different types of identities, they are all just "users", whether bots or something else. So when you create a bot, you either make a bot register for the account (using the SDK) or pre-register using a client for example Riot and just use the registered bot user token in the bot config.

How your bot reacts to say invites depends on how you program it to react.