Добрый день, решил сделать бота в телеграмм с помощью джанго. В итоге после запуска получаю ошибку:
Traceback (most recent call last):
File "C:\Users\Admin\Desktop\vgpgk\manage.py", line 22, in <module>
main()
File "C:\Users\Admin\Desktop\vgpgk\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 279, in fetch_command
klass = load_command_class(app_name, subcommand)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 49, in load_command_class
return module.Command()
AttributeError: module 'main.management.commands.bot' has no attribute 'Command'
Код проекта:
from django.core.management.base import BaseCommand
import logging
from aiogram import Bot, Dispatcher, executor, types
API_TOKEN = 'BOT TOKEN HERE'
# Configure logging
logging.basicConfig(level=logging.INFO)
# Initialize bot and dispatcher
bot = Bot(token='5351967410:AAGiYpYCfBmzrBUb9Ca0-KOz4WiK_t-hAyU')
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("Hi!\nI'm EchoBot!\nPowered by aiogram.")
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)
Структура проекта: