Add way to export tasks as raw text (no numbering, shows all tasks unfiltered)
This commit is contained in:
parent
f3ea3a108b
commit
15588b80ed
@ -14,7 +14,6 @@ If no command is specified, it is assumed to be the add command.
|
||||
|
||||
|
||||
## todo
|
||||
- exporting all tasks
|
||||
- favourite commands
|
||||
- reminders for tasks with due dates
|
||||
- use a real database instead of json files
|
||||
@ -22,3 +21,4 @@ If no command is specified, it is assumed to be the add command.
|
||||
- default filters
|
||||
- `Task` object generates new string on `__str__` method instead of relying on
|
||||
accurate updating from functions
|
||||
- ~~exporting all tasks~~
|
||||
|
13
bot.py
13
bot.py
@ -48,6 +48,8 @@ def on_message(msg):
|
||||
do_tasks(arguments, chat_id)
|
||||
elif command == '/undo':
|
||||
undo_tasks(arguments, chat_id)
|
||||
elif command == '/export':
|
||||
export_tasks(chat_id)
|
||||
elif command == '/marco':
|
||||
marco(chat_id)
|
||||
else:
|
||||
@ -214,6 +216,17 @@ def undo_tasks(task_ids, chat_id):
|
||||
bot.sendMessage(chat_id, "Undid task {0}".format(i))
|
||||
|
||||
|
||||
def export_tasks(chat_id):
|
||||
text = get_tasks(chat_id, raw=True)
|
||||
if text == "":
|
||||
bot.sendMessage(chat_id, "No tasks.")
|
||||
return
|
||||
|
||||
bot.sendMessage(chat_id, "RAW:")
|
||||
bot.sendMessage(chat_id, text)
|
||||
return
|
||||
|
||||
|
||||
def marco(chat_id):
|
||||
bot.sendMessage(chat_id, "Polo")
|
||||
|
||||
|
Reference in New Issue
Block a user