Esempio n. 1
0
async def addData(message: types.Message):
    data = message.text[5:].split(' ')
    task = ""
    for word in data:
        if word != data[0]:
            task += word + " "
    if not data or not task:
        await message.answer("Incorrect input for /add command, use /help")
    else:
        subject = Subject.Subject(data[0], None, task, None)
        try:
            Storage.AddSub(message.from_user.id, subject)
            await message.answer("your task was inserted\n\n" + task + "\nfor subject: " + data[0])
        except AppExceptions.Not_Enough_Data as error:
            print(error)
            print("Incorrect input for /add command, use /help")
        except Exception as e:
            print(e)
            print("Error can not insert your data")