T
T
Timyr2894372020-12-29 19:22:28
Python
Timyr289437, 2020-12-29 19:22:28

Why does a telegram bot either work or not?

Why the bot in the telegram either works or not, the bot is written in the aiogram library, I don’t change anything in the code, so the bot code is just

stupidly silent and displays this 2020-12-29 19:26:32.815641
is just nonsense

from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
from aiogram.types import ReplyKeyboardRemove, \
    ReplyKeyboardMarkup, KeyboardButton, \
    InlineKeyboardMarkup
bot = Bot(token='665694383:AAHtn_mEYlyOgYliAkDKtDNKMSpvV1ePVuE')
dp = Dispatcher(bot)
@dp.message_handler(commands=['start'])
async def start(message):
    global now

    try:

        user_id_start = message.chat.id
        user_id_Pyatochka_start = 'a' + str(user_id_start)
        con_start = psycopg2.connect(
            host='localhost',
            database='Drive_in',
            user='postgres',
            password='42661902',
            port=5432)

        cur_start = con_start.cursor()
        cur_start.execute(f"UPDATE {user_id_Pyatochka_start} SET class = '" + str(0) + "' WHERE id =" + str(1))

        cur_start.execute(f"UPDATE {user_id_Pyatochka_start} SET statys = '" + str(0) + "' WHERE id =" + str(1))
        cur_start.execute(f"UPDATE {user_id_Pyatochka_start} SET keyboard = '" + str(0) + "' WHERE id =" + str(1))

        con_start.commit()
        con_start.close()
    except:
        print("Ошибка 131")




    await bot.send_message(message.from_user.id, 'Выберите магазин из которого хотите получить товар', reply_markup=kb.greet_shop)
executor.start_polling(dp)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question