Open iamzoltan opened 10 months ago
Outlining what we need for matrix bot, using telegram bot as example:
Help text showing all the funtionality:
test art bot v0.1a12
commands work on a user per user basis!
config is individual to each user!
/txt2img TEXT - request an image based on a prompt
/img2img <attach_image> TEXT - request an image base on an image and a prompt
/redo - redo last command (only works for txt2img for now!)
/help step - get info on step config option
/help guidance - get info on guidance config option
/cool - list of cool words to use
/stats - user statistics
/donate - see donation info
/config algo NAME - select AI to use one of:
/config model NAME - select AI to use one of:
midj
stable
stable2
stablexl0.9
hdanime
waifu
ghibli
van-gogh
pokemon
ink
robot
stablexl
/config step NUMBER - set amount of iterations
/config seed [auto|NUMBER] - set the seed, deterministic results!
/config width NUMBER - set horizontal size in pixels
/config height NUMBER - set vertical size in pixels
/config upscaler [off/x4] - enable/disable x4 size upscaler
/config guidance NUMBER - prompt text importance
/config strength NUMBER - importance of the input image for img2img
Functions & database schema for client side bots: https://github.com/skygpu/skynet/blob/master/skynet/db/functions.py
Generic work request function (given a request & message / chat id return image): https://github.com/skygpu/skynet/blob/8a415b450f0be57fdf633ccca6c109dc638f933e/skynet/frontend/telegram/__init__.py#L112
Set config telegram handler: https://github.com/skygpu/skynet/blob/8a415b450f0be57fdf633ccca6c109dc638f933e/skynet/frontend/telegram/handlers.py#L61
Also some values are taken from: https://github.com/skygpu/skynet/blob/8a415b450f0be57fdf633ccca6c109dc638f933e/skynet/constants.py#L35
Ah! and forgot to point out the cmd line entry points:
for telegram bot: https://github.com/skygpu/skynet/blob/8a415b450f0be57fdf633ccca6c109dc638f933e/skynet/cli.py#L366
for database: https://github.com/skygpu/skynet/blob/8a415b450f0be57fdf633ccca6c109dc638f933e/skynet/cli.py#L318
Prolly maubot is the fastest to get going since it's a pretty decent ecosystem as far as i gather. Specifically the python apis are similar using decorator style:
from maubot import Plugin, MessageEvent
from maubot.handlers import command
class ExampleBot(Plugin):
@command.new()
async def hello_world(self, evt: MessageEvent) -> None:
await evt.reply("Hello, World!")
asyncio
based (like the other chat bots): https://docs.mau.fi/maubot/dev/python-tips.htmlI'd like to move this to the body description likely so that this comment doesn't get too long 😂
The normal mode in maubot is very dynamic: the config file doesn't really contain any runtime details other than a general web server, database, etc. Everything else is set up at runtime using the web management interface or the management API directly. This dynamicness is very useful for developing bots and works fine for deploying it on personal servers, but it's not optimal for larger production deployments.
The solution is standalone mode: a separate entrypoint that runs a single maubot plugin with a predefined Matrix account.
Additionally, standalone mode supports using appservice transactions to receive events instead of /sync, which is often useful for huge production instances with lots of traffic.
Follow up quick sniff for GH-only themed matrix bots in python (since other deps are in that):
https://github.com/topics/matrix-bot?l=python https://github.com/vranki/hemppa https://github.com/valcanobacon/BoostBots https://github.com/coffeebank/coffee-maubot https://github.com/Forden/aiomatrix https://github.com/uniberry-info/lokibot https://github.com/dominiwe/matrix-ai-assistant
Not sure any of those support encrypted rooms--not that it has to, but I know encrypted room support is supposed to be easier in Python vs. Java. FWIW I tried using a laimon proxy but never got it to work (not E2E & also the E2E docs are ambiguous).
Not sure any of those support encrypted rooms--not that it has to,
I mean I already linked to this:
decisions about whether or not to do encryptiion
in case it wasn't clear bc nooone is clicking links -> encryption is 💯 supported
Ok, so idea would be:
maubot
We already have a discord and telegram bot, so this should not be too bad, but I think it would be cool to have an additional matrix bot for skynet