[Python] Problems with the telegram chatbot. The chat was not found, although it is there

Discussão em 'Python' iniciado por Stack, Dezembro 1, 2024.

  1. Stack

    Stack Membro Participativo

    Bot is the first bot to communicate with the mailing management, and botspam is the bot in which the mailing takes place.

    def step5(message):
    global p
    conn = sqlite3.connect('../chatgpt_database.db')
    cursor = conn.cursor()
    cursor.execute("SELECT tid FROM Users")
    massive_big = cursor.fetchall()
    sss = [ ]
    sss = []
    for photo in photos:
    if '.jpg' in photo:
    sss.append(telebot.types.InputMediaPhoto(open(photo, 'rb'), caption=txt))
    else:
    sss.append(telebot.types.InputMediaVideo(open(photo, 'rb'), caption=txt))
    for z in range(len(massive_big)):
    # try:
    if not p:
    botspam.send_message(int(massive_big[z][0]), txt)
    else:
    botspam.send_media_group(int(massive_big[z][0]), sss)
    # except:
    # print(-1)
    p = True
    bot.send_message(message.chat.id, "Отправка окончена, для новой рассылки нажми /start")


    The error is this

    telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: chat not found


    The error are reflected in this lines

    if not p:
    botspam.send_message(int(massive_big[z][0]), txt)
    else:
    botspam.send_media_group(int(massive_big[z][0]), sss)


    Thank you in advance for your help

    Continue reading...

Compartilhe esta Página