-
-
Notifications
You must be signed in to change notification settings - Fork 806
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce6b1ab
commit 1e6aa38
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import asyncio | ||
import logging | ||
|
||
from aiogram import Bot, types | ||
from aiogram.dispatcher import Dispatcher | ||
|
||
API_TOKEN = 'BOT TOKEN HERE' | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
loop = asyncio.get_event_loop() | ||
bot = Bot(token=API_TOKEN, loop=loop) | ||
dp = Dispatcher(bot) | ||
|
||
|
||
@dp.inline_handler() | ||
async def inline_echo(inline_query: types.InlineQuery): | ||
item = types.InlineQueryResultArticle('1', 'echo', types.InputTextMessageContent(inline_query.query)) | ||
await bot.answer_inline_query(inline_query.id, results=[item], cache_time=1) | ||
|
||
|
||
if __name__ == '__main__': | ||
try: | ||
loop.run_until_complete(dp.start_pooling()) | ||
except KeyboardInterrupt: | ||
loop.stop() |