-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
37 lines (25 loc) · 971 Bytes
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import logging
import os
from aiogram import Bot, Dispatcher, executor, types
# load api token from .env file
from dotenv import load_dotenv
from nn import Prediction
load_dotenv()
# Configure logging
logging.basicConfig(level=logging.INFO)
# Initialize bot and dispatcher
bot = Bot(token=os.getenv("API_TOKEN"))
dp = Dispatcher(bot)
@dp.message_handler(commands=['start', 'help'])
async def send_welcome(message: types.Message):
"""
This handler will be called when user sends `/start` or `/help` command
"""
await message.reply("Привет!\nЯ бот, который отвечает на вопросы о поступлении. Пиши мне!",
reply_markup=types.ReplyKeyboardRemove())
@dp.message_handler()
async def echo(message: types.Message):
await message.answer(predictor.run(message.text))
if __name__ == '__main__':
predictor = Prediction()
executor.start_polling(dp, skip_updates=True)