ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   Общие вопросы программирования (https://forum.antichat.xyz/forumdisplay.php?f=206)
-   -   помощь с кодом бота (https://forum.antichat.xyz/showthread.php?t=1508882)

лимаров 20.04.2024 18:55

написал код бота, вроде норм должно, но выдает ошибку перевел все, все равно нихуя не понял, библиотеки поставил aiogram и executor





https://forum.antichat.xyz/attachmen...36ebb1a953.png

код ниже

123:





Код:

import
config
import
logging
from
aiogram
import
Bot
,
Dispatcher
,
executor
,
types
# log
logging
.
basicConfig
(
level
=
logging
.
INFO
)
# init
bot
=
Bot
(
token
=
config
.
TOKEN
)
dp
=
Dispatcher
(
bot
)
# echo
@dp.massege_handler
(
)
async
def
echo
(
massage
:
types
.
Massage
)
:
await
massage
.
answer
(
massage
.
text
)
# run long=polling
if
__name__
==
"__main__)"
:
executor
.
start_polling
(
dp
,
skip_updates
=
False
)


TravkaCode.lover() 20.04.2024 18:57

from aiogram.utils import executor

лимаров 20.04.2024 19:01

Цитата:


from aiogram.utils import executor

покажи в коде куда это

minxty 20.04.2024 19:28

Цитата:

Сообщение от лимаров

покажи в коде куда это

в самое начало

TravkaCode.lover() 20.04.2024 20:33

Цитата:

Сообщение от лимаров

покажи в коде куда это

из from aiogram import Bot, Dispatcher, executor, types убираешь executor и вставляешь ниже

from aiogram.utils import executor

Fomikus 20.04.2024 20:42

У тебя стоит новый aiogram (3.X.X+), а ты пытаешься писать как в 2.X.X версии.

Официальный пример - тык

Неплохой стартовый гайд - тык

Гайд на миграцию со старой версии на новую - тык (Там же полная вики по Aiogram 3.x.x+)


Время: 09:46