format code

This commit is contained in:
2026-08-10 10:11:48 +03:00
parent 9191242a93
commit 1be9a73dbd
3 changed files with 16 additions and 18 deletions
+10 -7
View File
@@ -1,20 +1,21 @@
import asyncio
import configparser
import asyncio
import configparser
from aiogram import Bot, Dispatcher, F
from aiogram.filters import Command
from aiogram.types import Message, InlineQuery, InlineKeyboardButton, InlineKeyboardMarkup, InlineQueryResultArticle, InputTextMessageContent,BufferedInputFile, InputMediaPhoto, ChosenInlineResult
from aiogram.types import Message, InlineQuery, InlineKeyboardButton, InlineKeyboardMarkup, InlineQueryResultArticle, InputTextMessageContent, BufferedInputFile, InputMediaPhoto, ChosenInlineResult
from io import BytesIO
from image import generate_quote
from formater import format_quote
dp = Dispatcher()
dp = Dispatcher()
bot = None
works = {}
async def main():
global bot
cfg = configparser.ConfigParser()
@@ -25,18 +26,20 @@ async def main():
token = cfg['bot']['BOT_TOKEN']
if len(token) == 0:
raise "token seems empty"
bot = Bot(token=token)
bot = Bot(token=token)
print("Starting bot...")
try:
await dp.start_polling(bot)
await dp.start_polling(bot)
finally:
print("Bot stopped")
@dp.message(F.text, Command("start"))
async def start(message: Message):
await message.answer(f"usage:\n\n@{(await bot.get_me()).username} some cool quote")
@dp.inline_query()
async def inline_query(query: InlineQuery):
text = query.query.strip()
@@ -109,4 +112,4 @@ async def chosen_inline_result(result: ChosenInlineResult):
)
if __name__ == '__main__':
asyncio.run(main())
asyncio.run(main())