-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (29 loc) · 1.2 KB
/
main.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 hashlib
from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import InlineQuery
import search_queries
import utils
import os
def bot_(API_TOKEN):
logging.basicConfig(level=logging.INFO)
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands=['start', 'help'])
async def send_welcome(message: types.Message):
await message.answer(
"Привет\n"
"Я еще в разработке, но уже умею составлять поисковые запросы в инлайн режиме. Попробуй написать "
"@searched_ur_mouth_bot")
@dp.message_handler()
async def echo(message: types.Message):
mess = message.answer(message.text)
print(f"{message.from_user.username} сказал:\n {message.text} \n\n")
await mess
@dp.inline_handler()
async def inline_process(inline_query: InlineQuery):
text = inline_query.query
results = []
if text:
await bot.answer_inline_query(inline_query.id, results=search_queries.create_results_list(text), cache_time=1)
executor.start_polling(dp, skip_updates=True)