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:
parent
5a6c560086
commit
2f5225d8ac
|
@ -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'
|
Loading…
Reference in New Issue