Answer the question
In order to leave comments, you need to log in
What to do if the bot on telebot in Pydroid does not start?
What to do if the bot on telebot in Pydroid does not start?
The code:
import telebot
from telebot import types
bot = telebot.TeleBot('api')
@bot.message_handler(commands=['start'])
def start(message):
bot.send_message(message.chat.id,
f'''
<b>Привет, {message.from_user.first_name}!
Добро пожаловать в Potato Team!</b>''', parse_mode = 'html', reply_markup = start_menu)
start_menu = types.InlineKeyboardMarkup(row_width=2)
start_menu.add(
types.InlineKeyboardButton(text='Помощь', callback_data='help'))
@bot.callback_query_handler(func=lambda call: True)
def help(call):
if call.data == 'help':
bot.send_message(call.message.chat.id, f'''
<b>Админ/Тех.Поддержка: @barltg</b>''', parse_mode = 'html', reply_markup = backtomenu)
elif call.data == 'back':
bot.send_message(call.message.chat.id,
f'''
<b>Привет, {call.from_user.first_name}!
Добро пожаловать в Potato Team!</b>''', parse_mode = 'html', reply_markup = start_menu)
backtomenu = types.InlineKeyboardMarkup(row_width=2)
backtomenu.add(
types.InlineKeyboardButton(text='Назад', callback_data='back'))
print("Успешный запуск!")
bot.polling(none_stop = True)
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>
start(fakepyfile,mainpyfile)
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
exec(open(mainpyfile).read(), __main__.__dict__)
File "<string>", line 2, in <module>
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/telebot/types.py", line 12, in <module>
from telebot import util
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/telebot/util.py", line 322, in <module>
def user_link(user: types.User, include_id: bool=False) -> str:
AttributeError: partially initialized module 'telebot.types' has no attribute 'User' (most likely due to a circular import)
[Program finished]
Answer the question
In order to leave comments, you need to log in
Most likely, you installed the wrong lib.
pip uninstall telebot # удалить телебот
pip install pyTelegramBotAPI # установить нужную либу
pip install pytelegrambotapi --upgrade # ЛИБО обновить
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question