I can't run the telegram bot

I can’t run the telegram bot…

error:

Traceback (most recent call last):

File "main.py", line 3, in <module>
  from aiogram.types import ParseMode, InlineKeyboardButton, InlineKeyboardMarkup
ImportError: cannot import name 'ParseMode' from 'aiogram.types' (/home/runner/YouUp-Community-Verification-Bot/.pythonlibs/lib/python3.10/site-packages/aiogram/types/___init__.py)

Repl link:

code snippet

Please, share the link to your repl so we can help you further.

1 Like

This is a test code where we have removed personal data.

Error:
File "main.py", line 3, in <module>
  from aiogram.types import ParseMode, InlineKeyboardButton, InlineKeyboardMarkup
ImportError: cannot import name 'ParseMode' from 'alogram.types'

https://replit.com/@andrewkkk1/TEST-BOT?s=app

I think the API changed and ParseMode is now part of aiogram.enums instead of aiogram.types.

Remove everything that have ParseMode from your code.

So, start by removing from your import

from aiogram.types import ParseMode, InlineKeyboardButton, InlineKeyboardMarkup #remove the parsemode

Replace all the instances in your code where you’ve used ParseMode.MARKDOWN or ParseMode.MARKDOWNV2 with the string values 'Markdown' or 'MarkdownV2' respectively.

For example:

parse_mode=ParseMode.MARKDOWNV2

Change to:

parse_mode='MarkdownV2'