![]() |
Начал писать бота для телеги, вылезла это ошибка:
Traceback (most recent call last): File "main.py", line 3, in from telebot import types ImportError: cannot import name 'types' from 'telebot' (/home/runner/telebot/venv/lib/python3.8/site-packages/telebot/__init__.py) А сам код для бота вот: import telebot import requests from telebot import types bot = telebot.TeleBot("5468636017:AAE03qPOxTkGhTuIyP2NBO lNbdomFMFM-g4") @bot.message_handler(commands=["start",]) def start(message): bot.send_message(message.chat.id,f"hi") @bot.message_handler(commands=['help']) def button_message(message): markup=types.ReplyKeyboardMarkup(resize_keyboard=T rue) item1=types.KeyboardButton("Мой вк") markup.add(item1) bot.send_message(message.chat.id,'Выберите что вам надо',reply_markup=markup) @bot.message_handler(content_types='text') def message_reply(message): if message.text=="Мой вк": bot.send_message(message.chat.id,"https://vk.com/trumtrum2") bot.infinity_polling() Писал на этом сайте https://replit.com/@sanyaaaaaa/telebot#main.py |
Дубликат темы: https://www.blast.hk/threads/157364/
Можешь попробовать: pip uninstall telebot pip uninstall pyTelegramBotAPI pip install git+https://github.com/eternnoir/pyTelegramBotAPI.git |
pip install PyTelegramBotAPI, а лучше переходи на aiogram, он лучше в разы
|
| Время: 15:07 |