ссылка на моего телеграм-бота: https://t.me/insertdata_bot
link to my telegram bot: https://t.me/insertdata_bot
инструкция по использованию бота:
- создаем бота в https://t.me/BotFather, получаем токен и записываем его в строчку "bot = telebot.TeleBot('token')"
- указываем путь к директории вашего проекта flask, где хранятся картинки в строке "with open('C:/Users/motor/OneDrive/Рабочий стол/pythonProject1/flask/static/images/' + file_name, 'wb') as file:" (p.s python понимает путь к чему-либо только при использовании косой черты)
- указываем название вашей базы данных и пароль в строке "conn = psycopg2.connect(dbname='test', user='postgres', password='password', host='127.0.0.1')"
- в запросе "INSERT INTO shop VALUES (%s, %s, %s, %s)", data" пишем название вашей таблицы после слова "INTO"
- указываем путь к pgadmin4 на вашем компьютере в строке "os.startfile('C:/Program Files/PostgreSQL/15/pgAdmin 4/bin/pgAdmin4.exe')"
- готово. можете использовать бота!
instructions for using the bot:
- create a bot in https://t.me/BotFather , we get a token and write it in the line "bot = telebot.TeleBot('token')"
- specify the path to the directory of your flask project, where the images are stored in the line "with open('C:/Users/motor/OneDrive/Desktop/pythonProject1/flask/static/images/' + file_name, 'wb') as file:" (p.s python understands the path to something only when using a slash)
- specify the name of your database and password in the line "conn = psycopg2.connect(dbname='test', user='postgres', password='password', host='127.0.0.1')"
- in the query "INSERT INTO shop VALUES (%s, %s, %s, %s)", data" we write the name of your table after the word "INTO"
- specify the path to pgadmin 4 on your computer in the line "os.startfile('C:/Program Files/PostgreSQL/15/pgAdmin 4/bin/pgAdmin4.exe ')"
- done. you can use the bot!