Add raw support for get_tasks function
This commit is contained in:
5
bot.py
5
bot.py
@@ -98,7 +98,7 @@ def set_property(property_name, value, chat_id):
|
|||||||
info_dict = file.write(json.dumps(info_dict))
|
info_dict = file.write(json.dumps(info_dict))
|
||||||
|
|
||||||
|
|
||||||
def get_tasks(chat_id):
|
def get_tasks(chat_id, raw=False):
|
||||||
with open(config['tasks_file']) as file:
|
with open(config['tasks_file']) as file:
|
||||||
tasks_dict = json.loads(file.read())
|
tasks_dict = json.loads(file.read())
|
||||||
|
|
||||||
@@ -110,6 +110,9 @@ def get_tasks(chat_id):
|
|||||||
if chat_id not in tasks_dict:
|
if chat_id not in tasks_dict:
|
||||||
tasks_dict[chat_id] = ""
|
tasks_dict[chat_id] = ""
|
||||||
|
|
||||||
|
if raw:
|
||||||
|
return tasks_dict[chat_id]
|
||||||
|
|
||||||
tasks = []
|
tasks = []
|
||||||
for i in tasks_dict[chat_id].split('\n'):
|
for i in tasks_dict[chat_id].split('\n'):
|
||||||
tasks.append(Task(i))
|
tasks.append(Task(i))
|
||||||
|
|||||||
Reference in New Issue
Block a user