LunaMech is finally FOSS software

Source and website.

26th of August 2021 at 15:30pm SAST

I have finally taken the time to extract all the hardcoded private keys and place them in a persistent library, meaning I am able to make LunaMech FOSS. LunaMech has been running on the Matrix server for close to a year now and has been under constant active development. It will remain under constant active development into the future as well. As of the time of writing this entry the bot will not build from source because I wrote a new macro called 'defmodule' to wrap up the process of defining new modules, but this does not play nicely with the compiler by default which I have to fix at some point, I may even change the abstraction to a metaclass... I am not sure yet.

Right now there is only an outdated way to generate a functioning config file, obviously this code base has been in active development so I have been using a config file that was generated many moons ago and I have slowly adapted it to work with any incremental changes, but this does mean that the config generator is out of date. The documentation in the README is also out of date, regardless it does provide a general overview of the default features of the bot, that being said the fundamental design idea of communities is almost outdated now that Matrix Spaces are making solid progress.

There was some more up to date documentation that was hosted on a taiga instance, however this instance is gone and I no longer have the documentation so I will have to go through and make some new documentation.

Let me briefly explain Luna's functionality right now:

The core idea of Luna are 'communities' these are mappings of room ids to room names which maintain a list of all of the members within them and their administrators. Commands like 'ban' will ban a user from all of the rooms listed in the community, ofcourse this is becoming less relevant as Spaces progresses, however this is still in heavy use on our Homeserver, the same goes for invite. Invite is especially useful if you want invite only communities.

Luna maintains a list of communities with a file called 'communities.lisp' in a directory called config/, all persistent files for modules is also stored in this directory. The file communities.lisp is backed up roughly every 5 minutes, because Luna is effectively a naturally evolving program that was both the prototype and the product I still think that use the filesystem for persistence of the main file is a decent solution, although I could swap to Bknr.

Luna grabs messages for every 'listening-room' listed in each community and processes those messages, messages that start with '.' are assumed to be commands, however a completed command is something like '.<community-name>|<module name> <command-name> <args>', commands for modules are also invoked from within a community listening room. Once the prefix is checked the correct command is found within the global *commands* and invoked with the the arguments provided by the user. If the command is missing then its passed off to the default missing command generic which will decide whether to tell the user or not depending on their privilege.

After processing all of the messages for all of the communities and executing the functions as it should, Luna maps through all of the registered modules and hands the instance of the bot and the current sync object (I say object but its actually a list) off onto a method called 'on-sync' which every module is able to specialize, this is where much of the automatic functionality of Luna is found, because each module is able to perform actions based on the information in the sync object.

After doing this a few thousand times methods like 'on-save' are invoked so that modules can save themselves to whatever their persistent storage mechanism is, communities.lisp is also backed up.

Modules can be loaded and unloaded from Luna on the fly, loading invoked on-load-up, unloading on-module-unload. This is done either within your connected Sly session or using Lunas command invocation system.

This basic model is how all of the current functionality of Luna is implemented. Ofcourse this may change.

Anyway, hopefully I will get the time to write some developer docs and update the readme, I will host them on LunaMechs website.

Updates regarding Luna will be posted here for the foreseeable future.