mirror of
https://github.com/ada-dmitry/PyProg_ada.git
synced 2026-09-24 01:10:40 +00:00
add func - input numberic
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
hostname = "localhost"
|
hostname = "localhost"
|
||||||
databname = "ada"
|
databname = "postgres"
|
||||||
username = "postgres"
|
username = "ada"
|
||||||
passw = "Ri588856"
|
passw = "?Ri588856"
|
||||||
api = "6285042955:AAEPprYo9K7Ta0RkDcoqO2Z4Ejdw8to1NX0"
|
api = "6285042955:AAEPprYo9K7Ta0RkDcoqO2Z4Ejdw8to1NX0"
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
@@ -17,7 +17,7 @@ except psycopg2.errors.DuplicateTable:
|
|||||||
print("")
|
print("")
|
||||||
|
|
||||||
|
|
||||||
for i in range(15):
|
for i in range(20):
|
||||||
url = 'https://amwine.ru' + \
|
url = 'https://amwine.ru' + \
|
||||||
parser.pictures[i].find('a').find('img').attrs['data-src']
|
parser.pictures[i].find('a').find('img').attrs['data-src']
|
||||||
filename = f"Python/TeleBot/image/{i}.jpg"
|
filename = f"Python/TeleBot/image/{i}.jpg"
|
||||||
|
|||||||
+10
-4
@@ -15,7 +15,7 @@ except psycopg2.errors.UndefinedTable:
|
|||||||
import tableCreator
|
import tableCreator
|
||||||
array = FuncForBot.sel(cursor, 'parser')
|
array = FuncForBot.sel(cursor, 'parser')
|
||||||
finally:
|
finally:
|
||||||
FuncForBot.upd(connection, cursor, 'parser')
|
# FuncForBot.upd(connection, cursor, 'parser')
|
||||||
cursor.close()
|
cursor.close()
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
@@ -30,17 +30,23 @@ def start(m, res=False):
|
|||||||
markup.add(item1)
|
markup.add(item1)
|
||||||
markup.add(item2)
|
markup.add(item2)
|
||||||
bot.send_message(
|
bot.send_message(
|
||||||
m.chat.id, '"Рандомное вино!" - для получения карточки товара\n "Повтори!" - для повторения сообщений.', reply_markup=markup)
|
m.chat.id, '"Рандомное вино!" - для получения карточки товара\n Введите число(1-20) для вывода определенной позиции\n "Повтори!" - для повторения сообщений.', reply_markup=markup)
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler(content_types=["text"])
|
@bot.message_handler(content_types=["text"])
|
||||||
def handle_text(message):
|
def handle_text(message):
|
||||||
if (message.text.strip() == 'Рандомное вино!'):
|
m = message.text.strip()
|
||||||
|
if (m == 'Рандомное вино!'):
|
||||||
i = random.choice(array)
|
i = random.choice(array)
|
||||||
ans = f'Название: {i[1]}\nЦена: {i[2]}\nЦена без скидки: {i[3]}\nОценка: {i[4]}\n'
|
ans = f'Название: {i[1]}\nЦена: {i[2]}\nЦена без скидки: {i[3]}\nОценка: {i[4]}\n'
|
||||||
bot.send_message(message.chat.id, ans)
|
bot.send_message(message.chat.id, ans)
|
||||||
bot.send_photo(message.chat.id, open(i[5], 'rb'))
|
bot.send_photo(message.chat.id, open(i[5], 'rb'))
|
||||||
elif (message.text.strip() == 'Повтори!'):
|
elif (m.isnumeric() == True):
|
||||||
|
i = array[int(m)]
|
||||||
|
ans = f'Название: {i[1]}\nЦена: {i[2]}\nЦена без скидки: {i[3]}\nОценка: {i[4]}\n'
|
||||||
|
bot.send_message(message.chat.id, ans)
|
||||||
|
bot.send_photo(message.chat.id, open(i[5], 'rb'))
|
||||||
|
elif (m == 'Повтори!'):
|
||||||
bot.send_message(message.chat.id, 'Ввод: ' + message.text)
|
bot.send_message(message.chat.id, 'Ввод: ' + message.text)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user