1
0

Add way to export tasks as raw text (no numbering, shows all tasks unfiltered)

This commit is contained in:
Akbar Rahman 2018-07-11 19:55:37 +01:00
parent f3ea3a108b
commit 15588b80ed
Signed by: alvierahman90
GPG Key ID: 20609519444A1269
2 changed files with 14 additions and 1 deletions

View File

@ -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
View File

@ -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")