hemppa/modules/task.py

31 lines
851 B
Python
Raw Normal View History

2020-01-30 22:54:59 +02:00
import subprocess
import os
class MatrixModule:
async def matrix_message(self, bot, room, event):
args = event.body.split()
args.pop(0)
encoding="utf-8"
2020-01-31 22:26:01 +02:00
allowed_args = ['list', 'add', 'del','done', 'undo', 'calc']
2020-01-30 22:54:59 +02:00
# wrap task
if not args:
args=['list']
2020-01-31 22:26:01 +02:00
if args[0] not in allowed_args:
2020-01-30 22:54:59 +02:00
await bot.send_text(room, "command not allowed")
return()
result = subprocess.check_output(
["task",
"rc.confirmation:no",
"rc.verbose:list",
"rc.bulk:0",
"rc.recurrence.confirmation:yes"]
+ args, stderr=subprocess.DEVNULL)
await bot.send_text(room, result.decode(encoding))
def help(self):
return('taskwarrior')