From 2f5225d8ac6b7dd94dfa9780f33d5d60f2874cb0 Mon Sep 17 00:00:00 2001 From: Jarno Rankinen Date: Mon, 14 Nov 2022 20:16:49 +0200 Subject: [PATCH] Simple shopping list module based on the echo module, prints the list given as arguments back as a markdown checkbox list. Each line in the message is an item in the list, including the first line (without the \! call --- modules/kauppa.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 modules/kauppa.py diff --git a/modules/kauppa.py b/modules/kauppa.py new file mode 100644 index 0000000..0c91854 --- /dev/null +++ b/modules/kauppa.py @@ -0,0 +1,19 @@ +from modules.common.module import BotModule + + +class MatrixModule(BotModule): + async def matrix_message(self, bot, room, event): + rawlist = event.body.split(' ', 1) + rawlist.pop(0) + + mdlist = list() + rawlist = rawlist[0].splitlines() + for item in rawlist: + mdlist.append('- [ ] ' + item) + + self.logger.debug(mdlist) + + await bot.send_text(room, "\n".join(mdlist), event) + + def help(self): + return 'Formats the list given as arguments to a Markdown list'