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 \!<module name> call

This commit is contained in:
Jarno Rankinen 2022-11-14 20:16:49 +02:00
parent 5a6c560086
commit 2f5225d8ac
1 changed files with 19 additions and 0 deletions

19
modules/kauppa.py Normal file
View File

@ -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'