79230096

Date: 2024-11-27 11:42:15
Score: 1
Natty:
Report link

Your function cmd_start just cannot be handled because when your bot started polling, the cmd_start wasn't declared. You should place the cmd_start before you run the main function. You should have the code like this at least:

import logging
import asyncio
from aiogram.types import Message, FSInputFile
from aiogram.filters import CommandStart
from aiogram import Bot, Dispatcher


bot = Bot(token="79127??????????????????fXTNyc")
dp = Dispatcher()


logo_photo = FSInputFile('212649.png')

# the function is declared before entering the main working loop
@dp.message(CommandStart())
async def cmd_start(message: Message):
    await message.answer_photo(photo=logo_photo, caption='текст')

async def main():
    await dp.start_polling(bot)

# all handlers are declared and now you can run the bot
if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)
    asyncio.run(main())
Reasons:
  • Blacklisted phrase (1): ???
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Pro_Noob_228