Compare commits

20 Commits

Author SHA1 Message Date
b313b15686 Test fix nft_svc
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is failing
2022-05-08 01:11:56 +07:00
aacb413176 Some fix
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-08 01:06:05 +07:00
efc711cd3b Added jpeg to png converted images
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-08 01:02:04 +07:00
b77f1bc13d Remove jpeg's
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-08 00:49:08 +07:00
55f17606d6 Merge branch 'main' of https://gitea.gavt45.ru/gav/es-bot
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-08 00:44:41 +07:00
e0c9aad35a Update pictures 2022-05-08 00:44:19 +07:00
gav
8c558f7bc0 Merge pull request 'Job of fucking copywriter!!!' (#4) from text-edition into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #4
Reviewed-by: gav <a@a.aa>
2022-05-05 12:13:54 +07:00
gav
a66fde985f Merge branch 'main' into text-edition
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2022-05-05 12:13:24 +07:00
f97a8286b7 Updated gitignore
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-05 12:12:27 +07:00
1dfd81de31 Merge branch 'main' of https://gitea.gavt45.ru/gav/es-bot
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-05 12:11:40 +07:00
20eaea722f added images and updated svc 2022-05-05 12:11:20 +07:00
ee834376db Job of fucking copywriter!!!
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2022-05-04 22:05:35 +07:00
gav
ca6ac97e33 Merge pull request 'Job of fucking copiwriter!!!' (#3) from text-edition into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #3
Reviewed-by: gav <a@a.aa>
2022-05-04 21:03:34 +07:00
be430673f1 Job of fucking copiwriter!!!
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2022-05-04 21:02:03 +07:00
gav
2dc6327fe1 Merge pull request 'text-edition' (#2) from text-edition into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #2
2022-05-04 20:44:44 +07:00
221ff51d3d Text edited
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-04 20:43:53 +07:00
0fc4d0df82 Text edited
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-04 19:59:59 +07:00
fe897a596c Merge pull request 'Text edited' (#1) from text-edition into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #1
Reviewed-by: dshestakova <d.shestakova2@g.nsu.ru>
2022-05-04 16:58:04 +07:00
2bc65d37dd Merge branch 'main' into text-edition
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2022-05-04 16:56:46 +07:00
98136d93a2 Text edited
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
2022-05-04 16:34:01 +07:00
95 changed files with 347 additions and 85 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text

2
.gitignore vendored
View File

@ -2,3 +2,5 @@
tmp
.env
docker-compose-dev.yml
*.DS_Store*
.idea/

BIN
img.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 131 B

View File

@ -1,57 +1,61 @@
from vkwave.bots import Keyboard, ButtonColor
# menu
MENU = "Привет, друг! Это - бот инженерной школы. Инженерная школа - молодой проект на Механико-Математическом факультете НГУ."
MENU = """С помощью бота вы можете:
&#9881; пройти тест и получить индивидуальный NFT-талисман, сгенерированный специально для вас нейросетью;
&#9881; вступить в чат абитуриентов, студентов и преподавателей;
&#9881; пообщаться со студентом (можно выбрать с кем);
&#9881; пообщаться с руководителем ИШ или преподавателем (можно выбрать с кем)."""
MENU_KB = Keyboard()
MENU_KB.add_text_button(text="Пройти тест!", payload={"test": "-1"}, color=ButtonColor.POSITIVE)
MENU_KB.add_link_button(text="Общий чатик", link="https://vk.me/join/AJQ1dw97/SBEQYIyQdZfG69y")
MENU_KB.add_text_button(text="Пройти тест", payload={"test": "-1"}, color=ButtonColor.POSITIVE)
MENU_KB.add_link_button(text="Чат абитуриентов", link="https://vk.me/join/AJQ1dw97/SBEQYIyQdZfG69y")
MENU_KB.add_row()
MENU_KB.add_text_button(text="Пообщаться со студентом", payload={"student": "1"}, color=ButtonColor.PRIMARY)
MENU_KB.add_row()
MENU_KB.add_text_button(text="Пообщаться с преподавателем", payload={"teacher": "1"}, color=ButtonColor.PRIMARY)
MENU_KB.add_row()
MENU_KB.add_text_button(text="АЧе делать?", payload={"man": "1"}, color=ButtonColor.PRIMARY)
# MENU_KB.add_row()
# MENU_KB.add_text_button(text="АЧе делать?", payload={"man": "1"}, color=ButtonColor.PRIMARY)
# Student menu
ST_MENU = """Вот список студентов, которые могут рассказать тебе про Инженерную Школу
https://vk.com/cleverbitch - Булгакова Лиза, 2 курс
https://vk.com/shestakova__d - Шестакова Даша, 2 курс
https://vk.com/fossa_mar - Пискеева Даша, 2 курс
https://vk.com/brainkiller78 - Тищенко Данил, 1 курс
https://vk.com/skazaniyk - Хамутский Дима, 1 курс
https://vk.com/kirik229 - Шадрина Анжела, 2 курс
https://vk.com/dinazavrrrik - Коновалов Назар, 1 курс
https://vk.com/tenikeev - Еникеев Тимур, 1 курс
ST_MENU = """Если вы ходите узнать про жизнь студента Инженерной школы, то можете написать этим ребятам:
*fossa_mar (Даша Пискеева), 2 курс;
*shestakova__d (Даша Шестакова), 2 курс;
*cleverbitch (Лиза Булгакова), 2 курс;
*brainkiller78 (Данил Тищенко), 1 курс;
*skazaniyk (Дмитрий Хамутский), 1 курс;
*kirik229 (Анжела Шадрина), 2 курс;
*dinazavrrrik (Назар Коновалов), 1 курс;
*tenikeev (Тимур Еникеев), 1 курс.
"""
ST_KB = Keyboard()
ST_KB.add_link_button(text="Булгакова Лиза", link="https://vk.com/cleverbitch")
ST_KB.add_link_button(text="Шестакова Даша", link="https://vk.com/shestakova__d")
ST_KB.add_link_button(text="Даша Пискеева", link="https://vk.com/fossa_mar")
ST_KB.add_link_button(text="Даша Шестакова", link="https://vk.com/shestakova__d")
ST_KB.add_row()
ST_KB.add_link_button(text="Пискеева Даша", link="https://vk.com/fossa_mar")
ST_KB.add_link_button(text="Тищенко Данил", link="https://vk.com/brainkiller78")
ST_KB.add_link_button(text="Лиза Булгакова", link="https://vk.com/cleverbitch")
ST_KB.add_link_button(text="Данил Тищенко", link="https://vk.com/brainkiller78")
ST_KB.add_row()
ST_KB.add_link_button(text="Хамутский Дима", link="https://vk.com/skazaniyk")
ST_KB.add_link_button(text="Шадрина Анжела", link="https://vk.com/kirik229")
ST_KB.add_link_button(text="Дмитрий Хамутский", link="https://vk.com/skazaniyk")
ST_KB.add_link_button(text="Анжела Шадрина", link="https://vk.com/kirik229")
ST_KB.add_row()
ST_KB.add_link_button(text="Коновалов Назар", link="https://vk.com/dinazavrrrik")
ST_KB.add_link_button(text="Еникеев Тимур", link="https://vk.com/tenikeev")
ST_KB.add_link_button(text="Назар Коновалов", link="https://vk.com/dinazavrrrik")
ST_KB.add_link_button(text="Тимур Еникеев", link="https://vk.com/tenikeev")
ST_KB.add_row()
ST_KB.add_text_button(text="ХОЧУ ДОМОЙ!!!!!!!!!!!!!!!", payload={}, color=ButtonColor.NEGATIVE)
ST_KB.add_text_button(text="Вернуться на главную", payload={}, color=ButtonColor.NEGATIVE)
# Teacher menu
TC_MENU = """Вот список преподавателей, которые могут рассказать тебе про Инженерную Школу
https://vk.com/anastasia.v.karpenko - Карпенко Анастасия Валерьевна, преподаватель по логике и ОПД
https://vk.com/krkaushan - Насыбуллова Кристина Андреевна,
https://vk.com/id11073597 - Насыбуллов Тимур Ринатович, преподаватель по Алгебре и геометрии и ТФКП
https://vk.com/yury_efremenko - Ефременко Юрий Данилович, преподаватель по Алгебре и геометрии."""
TC_MENU = """Вы можете написать преподавателям и руководителям Инженерной школы:
*anastasia.v.karpenko (Анастасия Валерьевна Карпенко) — руководитель ИШ, преподаватель «Математической логики» и «Основ проектной деятельности»;
*krkaushan (Кристина Андреевна Насыбуллова) — заместитель декана по 2 курсу;
*id11073597 (Тимур Ринатович Насыбуллов) — преподаватель «Алгебры и геометрии» и «Теории функций комплексного переменного»;
*yury_efremenko (Ефременко Юрий Даниилович) — заместитель декана по набору, преподаватель «Алгебры и геометрии»."""
TC_KB = Keyboard()
TC_KB.add_link_button(text="Анастасия Валерьевна", link="https://vk.com/anastasia.v.karpenko")
TC_KB.add_link_button(text="Кристина Андреевна", link="https://vk.com/krkaushan")
TC_KB.add_row()
TC_KB.add_link_button(text="Тимур Ринатович", link="https://vk.com/id11073597")
TC_KB.add_link_button(text="Юрий Данилович", link="https://vk.com/yury_efremenko")
TC_KB.add_link_button(text="Юрий Даниилович", link="https://vk.com/yury_efremenko")
TC_KB.add_row()
TC_KB.add_text_button(text="ХОЧУ ДОМОЙ!!!!!!!!!!!!!!!", payload={}, color=ButtonColor.NEGATIVE)
TC_KB.add_text_button(text="Вернуться на главную", payload={}, color=ButtonColor.NEGATIVE)
# Manual
MAN = """Если вы хотите пройти тест - нажми на соответствующую кнопку.
@ -70,47 +74,53 @@ INPUT_NAME_TEXT = "Пожалуйста, введите имя:"
# 1
WHAT_ENGINEER_ARE_YOU = "Кто ты из инженеров?"
WHAT_ENGINEER_ARE_YOU_KB = Keyboard()
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Маск", payload={"q": "Маск"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Рогозин", payload={"q": "Рогозин"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Тесла", payload={"q": "Тесла"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Илон Маск", payload={"q": "Илон Маск"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Дмитрий Рогозин", payload={"q": "Дмитрий Рогозин"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_row()
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Кулибин", payload={"q": "Кулибин"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Калашников", payload={"q": "Калашников"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Кондратюк", payload={"q": "Кондратюк"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Никола Тесла", payload={"q": "Никола Тесла"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Иван Кулибин", payload={"q": "Иван Кулибин"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_row()
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Михаил Калашников", payload={"q": "Михаил Калашников"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Юрий Кондратюк", payload={"q": "Юрий Кондратюк"}, color=ButtonColor.PRIMARY)
# 2
PROG_LANG = "Какой ЯП нравится?"
PROG_LANG = "Какой язык программирования вы чаще всего используете?"
PROG_LANG_KB = Keyboard()
PROG_LANG_KB.add_text_button(text="Python", payload={"q": "Python"}, color=ButtonColor.PRIMARY)
PROG_LANG_KB.add_text_button(text="Pascal", payload={"q": "Pascal"}, color=ButtonColor.PRIMARY)
PROG_LANG_KB.add_text_button(text="C/C++", payload={"q": "ccpp"}, color=ButtonColor.PRIMARY)
PROG_LANG_KB.add_row()
PROG_LANG_KB.add_text_button(text="C/C++", payload={"q": "ccpp"}, color=ButtonColor.PRIMARY)
PROG_LANG_KB.add_text_button(text="JS", payload={"q": "JS"}, color=ButtonColor.PRIMARY)
PROG_LANG_KB.add_row()
PROG_LANG_KB.add_text_button(text="HTML+CSS", payload={"q": "HTMLCSS"}, color=ButtonColor.PRIMARY)
PROG_LANG_KB.add_text_button(text="Haskel", payload={"q": "Haskel"}, color=ButtonColor.PRIMARY)
PROG_LANG_KB.add_row()
PROG_LANG_KB.add_text_button(text="Java", payload={"q": "Java"}, color=ButtonColor.PRIMARY)
PROG_LANG_KB.add_text_button(text="Я не программирую", payload={"q": "Я не программирую"}, color=ButtonColor.PRIMARY)
# 3
FAV_THEME = "Какой предмет нравится?"
FAV_THEME = "Какая школьная дисциплина нравится вам больше?"
FAV_THEME_KB = Keyboard()
FAV_THEME_KB.add_text_button(text="Матеша", payload={"q": "Матеша"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_text_button(text="Русский/Литра", payload={"q": "русскийлитра"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_text_button(text="Инфа", payload={"q": "Инфа"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_text_button(text="Математика", payload={"q": "Математика"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_text_button(text="Русский/Литература", payload={"q": "русскийлитра"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_row()
FAV_THEME_KB.add_text_button(text="Информатика/программирование", payload={"q": "Инфа"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_text_button(text="Физика", payload={"q": "Физика"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_text_button(text="другое", payload={"q": "other"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_row()
FAV_THEME_KB.add_text_button(text="История/обществознание", payload={"q": "Инфа"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_text_button(text="Другой", payload={"q": "other"}, color=ButtonColor.PRIMARY)
# 4
EGE = "Как готовился к ЕГЭ?"
EGE = "Как вы готовитесь к ЕГЭ?"
EGE_KB = Keyboard()
EGE_KB.add_text_button(text="В школе", payload={"q": "школа"}, color=ButtonColor.PRIMARY)
EGE_KB.add_text_button(text="online", payload={"q": "online"}, color=ButtonColor.PRIMARY)
EGE_KB.add_text_button(text="репетитор", payload={"q": "репетитор"}, color=ButtonColor.PRIMARY)
EGE_KB.add_text_button(text="В онлайн-школе", payload={"q": "online"}, color=ButtonColor.PRIMARY)
EGE_KB.add_text_button(text="С репетитором", payload={"q": "репетитор"}, color=ButtonColor.PRIMARY)
EGE_KB.add_row()
EGE_KB.add_text_button(text="Сам", payload={"q": "Сам"}, color=ButtonColor.PRIMARY)
EGE_KB.add_text_button(text="wtf?", payload={"q": "wtf"}, color=ButtonColor.PRIMARY)
EGE_KB.add_text_button(text="Самостоятельно", payload={"q": "Сам"}, color=ButtonColor.PRIMARY)
EGE_KB.add_text_button(text="А? Какие экзамены?", payload={"q": "А? Какие экзамены?"}, color=ButtonColor.PRIMARY)
# 5
TRANS_ENGINEER_COUNT = "Сколько студентов ИШ надо, чтобы включить трансу?"
TRANS_ENGINEER_COUNT = "Сколько нужно инженеров, чтобы запустить трансляцию в Телемосте?"
TRANS_ENGINEER_COUNT_KB = Keyboard()
TRANS_ENGINEER_COUNT_KB.add_text_button(text="1", payload={"q": "1"}, color=ButtonColor.PRIMARY)
TRANS_ENGINEER_COUNT_KB.add_text_button(text="2", payload={"q": "2"}, color=ButtonColor.PRIMARY)
@ -118,12 +128,12 @@ TRANS_ENGINEER_COUNT_KB.add_text_button(text="5", payload={"q": "5"}, color=Butt
# 6
ZODIAC = "Кто вы по знаку зодиака?"
# 7
CONTACT = "Введите почту или ник в телеграмме, по которому мы сможем прислать вам результаты"
# ZODIAC_KB = Keyboard()
# # 7
# CONTACT = "Введите почту или ник в телеграмме, по которому мы сможем прислать вам результаты"
# last
LAST_MESSAGE = "Спасибо, что прошел тест!"
LAST_MESSAGE = "Теперь у вас есть ваш персональный NFT-талисман! Он поможет вам при сдаче экзаменов и поступлении в желаемый университет &#127775;"
LAST_MESSAGE_KB = Keyboard()
LAST_MESSAGE_KB.add_text_button(text="Вернуться на главную", payload={}, color=ButtonColor.POSITIVE)
@ -134,5 +144,5 @@ questions = [
(EGE, EGE_KB),
(TRANS_ENGINEER_COUNT, TRANS_ENGINEER_COUNT_KB),
(ZODIAC, None),
(CONTACT, None),
# (CONTACT, None),
]

View File

@ -1,34 +1,14 @@
import io
import random
import os
from PIL import Image
from flask import Flask, request, jsonify
import matplotlib.image as mpimg
import numpy as np
import numba
import pickle
import base64
app = Flask(__name__)
@numba.njit
def optimized_mandelbrot(n_rows, n_columns, iterations, cx, cy):
x_cor = np.linspace(-2, 2, n_rows)
y_cor = np.linspace(-2, 2, n_columns)
output = np.zeros((n_rows,n_columns))
c = cx + 1j * cy
for i in range(n_rows):
for j in range(n_columns):
z = x_cor[i] + y_cor[j] * 1j
count = 0
for k in range(iterations):
z = (z*z) + c
count += 1
if np.abs(z) > 4:
break
output[i, j] = count
return output.T
IMAGE_PATH = 'pics'
def open_image_as_array(path):
@ -36,23 +16,24 @@ def open_image_as_array(path):
def get_encoded_img(arr):
img = Image.fromarray(arr).convert("L")
img = Image.fromarray(arr)
img_byte_arr = io.BytesIO()
img.save(img_byte_arr, format='PNG')
encoded_img = base64.encodebytes(img_byte_arr.getvalue()).decode('ascii')
return encoded_img
return str(encoded_img)
@app.route('/getImage', methods=['GET'])
def get_image():
with open('data_100.pickle', 'rb') as f:
images = pickle.load(f)
buffered = io.BytesIO()
random.choice(images).save(buffered, format="JPEG")
img_str = base64.b64encode(buffered.getvalue())
# print(random.choice(os.listdir(IMAGE_PATH)))
file = os.path.join(IMAGE_PATH, random.choice(os.listdir(IMAGE_PATH)))
# buffered = io.BytesIO()
# image.save(buffered, format="JPEG")
# img_str = base64.b64encode(buffered.getvalue())
image = base64.encodebytes(open(file, 'rb').read()).decode('ascii')
return jsonify({
"code": 0,
"image": str(img_str.decode('ascii')),
"image": image,
"first_time": 1
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.