HOME FORUMS MEMBERS RECENT POSTS LOG IN  
× Авторизация
Имя пользователя:
Пароль:
Нет аккаунта? Регистрация
Баннер 1   Баннер 2
НОВЫЕ ТОРГОВАЯ НОВОСТИ ЧАТ
loading...
Скрыть
Вернуться   ANTICHAT > ПРОГРАММИРОВАНИЕ > Общие вопросы программирования
   
 
 
Опции темы Поиск в этой теме Опции просмотра

  #1  
Старый 29.03.2022, 14:55
fukuzaca
Новичок
Регистрация: 15.03.2022
Сообщений: 3
С нами: 2193335

Репутация: 1
По умолчанию

Я недавно начал пробывать себя в сфере ботов телеге.

При запуске выдает ошибку и говорит что эта фигня виновата (ниже)

bot = telebot.TeleBot("**********************")

код ошибки:





Код:
Traceback (most recent call last):
  File "D:\Python\bot.py", line 2, in 
    from telebot import types
  File "C:\Users\Gavrik\AppData\Local\Programs\Python\Python310\lib\site-packages\telebot\types.py", line 12, in 
    from telebot import util
  File "C:\Users\Gavrik\AppData\Local\Programs\Python\Python310\lib\site-packages\telebot\util.py", line 322, in 
    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)


Цитата:

сам код:





Код:
import telebot
from telebot import types

bot = telebot.TeleBot("******************)", parse_mode=None)

@bot.message_handler(commands=["start"])
def start (message):
    channel_link = "https://t.me/aogirilifestyle"
    markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
    keyboard = types.KeyboardButton(text="Confirm")
    markup.add(keyboard)
    chat_id = message.chat.id
    user = message.chat.first_name
    bot.send_message(chat_id, f"Hi {user} if u want to use bot you must subscribe to the channel/n"
        f"{channel_link}", reply_markup=markup)

@bot.message_handler(content_types=["text"])
def text(message):
    user = message.chat.first_name
    if message.chat.type == 'private':
        if message.text == 'Confirm':
            status = ['creator', 'administrator', 'member']
            for stat in status:
                if stat == bot.get_chat_member(char_id="@aogirilifestyle", user_id=message.from_user.id).status:
                    bot.send_message(message.chat.id, f"Open {user}")
                    break

                else:
                    bot.send_message(message.chat.id, "Sub to the channel!")

    bot.polling(none_stop=True)



Что делать? (((

Ошибку сверху исправил

появилась новая

 
Ответить с цитированием
 



Предыдущая тема Следующая тема

Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT ™ © 2001- Antichat Kft.