diff --git a/__init__.py b/__init__.py index f95798e..1795944 100644 --- a/__init__.py +++ b/__init__.py @@ -67,8 +67,7 @@ def workshop(): actionArgs) return redirect(url_for('workshop')) - if 'NewScenarioName' in request.form: - print('писька коня') + # if 'NewScenarioName' in request.form: if 'TGUsername' in request.form: new_tg_username = request.form['TGUsername'] @@ -81,7 +80,6 @@ def workshop(): User = db_routing.get_user(id=current_user.get_id()) if User: tg_username = User.tg_username - print(tg_username) else: tg_username = None return render_template('workshop.html', triggers_list=triggers_list, actions_list=actions_list, diff --git a/actions.py b/actions.py new file mode 100644 index 0000000..d1f1164 --- /dev/null +++ b/actions.py @@ -0,0 +1,36 @@ +# будильник +import datetime +import imaplib +import time + + +def alarm_clock(): + dt = datetime.datetime(2020, 3, 18, 18, 6, 15) # дата срабатывания будильника (год,месяц,день,час,минута,секунда) + diff = (dt - datetime.datetime.now()).total_seconds() + print(diff) + time.sleep(diff) + print('сообщение в телегу текст') + + +# проверка почты на новое письмо gmail +# Нужно включить https://myaccount.google.com/lesssecureapps и https://mail.google.com/mail/u/2/#settings/fwdandpop +# +def check_email(gmail_user, gmail_pass): + mail = imaplib.IMAP4_SSL('imap.gmail.com', 993) + mail.login(gmail_user, gmail_pass) + mail.list() + count_Email_Start = (mail.select("inbox")[1][0]).decode('utf-8') + while True: + mail.list() + count_Email_Current = (mail.select("inbox")[1][0]).decode('utf-8') + if count_Email_Current > count_Email_Start: + print('Отправить сообщение в телегу о том, а) занят б)текст') + count_Email_Start = count_Email_Current + time.sleep(15) # частота проверки нового письма + + +if __name__ == '__main__': + alarm_clock() + +# сценарии должны хранить логины и пароль +# запилить бота, возврат темы и отправителя в словаре. diff --git a/db_routing.py b/db_routing.py index 5fd503c..720d0e1 100644 --- a/db_routing.py +++ b/db_routing.py @@ -48,7 +48,7 @@ class Scenario(db.Model): __tablename__ = 'Scenarios' id = db.Column(db.Integer, primary_key=True) owner_id = db.Column(db.Integer, ForeignKey('Users.id')) - scenario_name = db.Column(db.String(80)) + scenario_name = db.Column(db.String(80), nullable=False) trigger_id = db.Column(db.Integer, ForeignKey('Triggers.id')) trigger_args = db.Column(db.String(200)) action_id = db.Column(db.Integer, ForeignKey('Actions.id')) diff --git a/templates/error.html b/templates/error.html index 304e56e..2f81dba 100644 --- a/templates/error.html +++ b/templates/error.html @@ -2,97 +2,104 @@ - - + + Jarvis - - + + -
- -
-
- -
-
-
- Нужна помощь? +
+ +
+
+ +
+
+
+ Нужна помощь? - +
-
- - -
-
-

404

-

not found

- -
-
- - -
-
- -
- - -
-
- - -
-
+
+ + +
+
+

404

+

not found

+ +
+
+ + +
+
+ +
+ + + \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 20193ab..c260755 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,137 +2,149 @@ - - + + Jarvis - - + + -
- -
-
- -
-
-
- {% if current_user.is_authenticated %} -

{{ current_user.username }}

- - {% else %} -
Войти
- - {% endif %} -
-
-
+
+ +
+
- -
-
-
-
- -
-
-
- Jarvis -
-
-

Ваш индивидуальный помощник на каждый день

-
-
- {% if current_user.is_authenticated %} - - +
+
+
+ {% if current_user.is_authenticated %} +

{{ + current_user.username }}

+
+ {% else %} +
Войти
+ + {% endif %}
-
- - -
- - -
-
- - -
-
+
+ +
+
+
+
+ +
+
+
+ Jarvis +
+
+

Ваш индивидуальный помощник на каждый день

+
+
+ {% if current_user.is_authenticated %} + + + + {% else %} + + + + {% endif %} +
+
+
+
+
+ + +
+ + + \ No newline at end of file diff --git a/templates/registration.html b/templates/registration.html index 9bc4556..ad58c20 100644 --- a/templates/registration.html +++ b/templates/registration.html @@ -13,123 +13,136 @@ -
- -
-
- -
-
-
-
Войти
- +
+ +
+
+ +
+
+
+
Войти
+
-
- +
+
-
-
-
- Создать аккаунт -
- -
-
-
-
- - -
-
-
-
-
- -
+
+
+
+ Создать аккаунт +
+ + +
+
+
+ + + +
+
+
+
+
+
- +
+
-
+
- -