Schlecht: Telegrammbot funktioniert nicht (Aiogramm)Python

Python-Programme
Anonymous
 Schlecht: Telegrammbot funktioniert nicht (Aiogramm)

Post by Anonymous »

Ich habe keine Ahnung, wie ich es beheben kann < /p>
Ich versuche Folgendes: < /p>

Code: Select all

@Router.message(F.text == "/start")
async def send_welcome(message: types.Message, state: FSMContext):
await state.set_state(UserState.awaiting_function)  # встановлюємо стан
await message.reply("Hi!\nI'm EchoBot!\nPowered by aiogram.")
< /code>
Und dies: < /p>
@dp.message(lambda message: message.text.lower() == '/start', state = FSMContext)
async def send_welcome(message: types.Message):
await state.set_state(UserState.awaiting_function)
""" Greets the user and introduces the bot """
await message.reply("Hi!\nI'm EchoBot!\nPowered by aiogram.")
< /code>
Das ist ein Fehler: < /p>
Traceback (most recent call last):
File "C:\Users\USER\PycharmProjects\PythonProject\bot_main\main.py", line 26, in 
@Router.message(FSMContext.text == "/start")
^^^^^^^^^^^^^^
AttributeError: type object 'Router' has no attribute 'message'
Jemand kann mir helfen? `

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post