bot finished
This commit is contained in:
38
bot.py
38
bot.py
@@ -21,13 +21,6 @@ dp = Dispatcher(bot)
|
||||
|
||||
@dp.message_handler(commands=['start', 'help'])
|
||||
async def send_welcome(message: types.Message):
|
||||
button1 = KeyboardButton(text='Очень плохо')
|
||||
button2 = KeyboardButton(text='Плохо')
|
||||
button3 = KeyboardButton(text='Хорошо')
|
||||
button4 = KeyboardButton(text='Очень хорошо')
|
||||
|
||||
markup = ReplyKeyboardMarkup(resize_keyboard=True).add(button1, button2, button3, button4)
|
||||
|
||||
|
||||
"""
|
||||
|
||||
@@ -36,36 +29,35 @@ async def send_welcome(message: types.Message):
|
||||
"""
|
||||
|
||||
await message.answer("Привет! Этот бот предназначен для дневника артериального давления. \n\
|
||||
Введите давление и пульс в формате 123 12 12", reply_markup=markup)
|
||||
Введите давление и пульс в формате \"123 12 12 хорошо\"", reply_markup=markup)
|
||||
|
||||
|
||||
|
||||
@dp.message_handler()
|
||||
async def echo(message: types.Message):
|
||||
button1 = KeyboardButton(text='Очень плохо')
|
||||
button2 = KeyboardButton(text='Плохо')
|
||||
button3 = KeyboardButton(text='Хорошо')
|
||||
button4 = KeyboardButton(text='Очень хорошо')
|
||||
tmp_davl = str(message.text).split()
|
||||
logging.debug(tmp_davl)
|
||||
davl = []
|
||||
if len(tmp_davl) > 3:
|
||||
count_len = 0
|
||||
for i in range(3):
|
||||
count_len = count_len + (len(tmp_davl[i]))
|
||||
davl.append(tmp_davl[i])
|
||||
count_len = count_len+len(davl[2])
|
||||
|
||||
markup = ReplyKeyboardMarkup(resize_keyboard=True).add(button1, button2, button3, button4)
|
||||
stroka =" ".join(tmp_davl)
|
||||
davl.append(stroka[count_len:len(stroka)])
|
||||
|
||||
|
||||
|
||||
|
||||
davl = str(message.text).split()
|
||||
|
||||
if
|
||||
logging.debug(davl)
|
||||
|
||||
|
||||
|
||||
app = create_app()
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'
|
||||
with app.app_context():
|
||||
|
||||
wtdb = ArtDavl(davlh=davl[0],
|
||||
davll=davl[1], puls=davl[2],
|
||||
sostoyanie="OTL",
|
||||
davll=davl[1],
|
||||
puls=davl[2],
|
||||
sostoyanie=davl[3],
|
||||
dateadd=datetime.now().strftime('%d.%m.%Y'),
|
||||
timeadd=datetime.now().strftime('%H:%M'))
|
||||
db.session.add(wtdb)
|
||||
|
||||
Reference in New Issue
Block a user