diff --git a/main.py b/main.py index 75c5f7b..c55e90a 100644 --- a/main.py +++ b/main.py @@ -30,12 +30,20 @@ def handler_add_task(update, context): if len(context.args) < 3: update.message.reply_text('Podaj, proszę, tytuł jako argument') return + + msg_text = update.message.text_markdown.lstrip('/add\\_task').strip() # need to work on this, because context.args doesn't indicate new lines + first_newline = msg_text.find('\n') - context.args[0] = context.args[0].capitalize() + title = '' + description = '' - title = ' '.join(context.args) + if first_newline == -1: + title = msg_text.capitalize() + else: + title = msg_text[:first_newline].capitalize() + description = msg_text[first_newline + 1:].strip() + description += '\n\n' - description = '' description += ' *Dodane przez:* {} '.format(update.message.from_user.name) description += '\nlink do wiadomości: {} '.format(update.message.link)