lanonna/README.org

56 lines
2 KiB
Org Mode
Raw Normal View History

2024-03-16 09:33:43 +01:00
* La Nonna
La Nonna is a matrix bot that we use on the goulash.lezzo.org matrix server.
It's an appreciation to our dear grandmothers who spent so much time with us,
caring even about the smallest things.
* How it works
The La Nonna bot always accepts invites to a matrix channel. It listens to
commands in the irc format, starting with '!' and followed by a lowercase word. Every time La Nonna receives a
sentence starting with the command token it splits it into two parts, the
command keyword and the arguments. See lanonna/commands.py for the parsing routine.
La Nonna sends the parsed message to the default exchange of a RabbitMQ
instance, using as routing key the command keyword. The message has the
following JSON format, as you can see from lanonna/protocol.py:
#+begin_src
command: str
content: str
source_message_id: str
sender_nick: str
room_id: str
#+end_src
La Nonna has a static list of commands keyword that are accepted and then
forwarded to RabbitMQ. For every other keyword not in this list, a help message
is sent to the originating matrix channel.
La Nonna expects other software from this repo to consume the message from
RabbitMQ. La Nonna consumes messages from the "lanonna" exchange and expects
messages in this format, as you can see from lanonna/protocol.py:
#+begin_src
content: str
source_message_id: str | None
room_id: str
as_reply: bool # requires source_message_id
as_markdown: bool
#+end_src
** Configuration
La Nonna and every other RabbitMQ consumer in this repo, will read a single
configuration file named /etc/lanonna.toml that contains a subsection for every
RabbitMQ consumer.
Example configuration file:
#+begin_src
[lanonna]
matrix_url = "https://matrix.example.org"
matrix_username = "@lanonna:matrix.example.org"
matrix_password = "theol'days"
mq_url = "amqp://rabbitmq:rabbitmq@rabbimq.example.org/"
[pam]
forgejo_base64 = "dGhlb2wnZGF5cwo="
mq_url = "amqp://rabbitmq:rabbitmq@rabbitmq.example.org/"
#+end_src